mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 11:38:39 -05:00 
			
		
		
		
	fuse_opt: implementation checkpoint
This commit is contained in:
		| @@ -168,23 +168,21 @@ static int fsp_fuse_opt_call_proc(void *data, | |||||||
|  |  | ||||||
|     if (is_opt) |     if (is_opt) | ||||||
|     { |     { | ||||||
|         if (3 <= outargs->argc && |         if (!(3 <= outargs->argc && | ||||||
|             '-' == outargs->argv[1][0] && 'o' == outargs->argv[1][1] && |             '-' == outargs->argv[1][0] && 'o' == outargs->argv[1][1] && | ||||||
|             '\0' == outargs->argv[1][2]) |             '\0' == outargs->argv[1][2])) | ||||||
|         { |  | ||||||
|             result = fsp_fuse_opt_add_opt(&outargs->argv[2], arg, FSP_FUSE_MEMFN_A); |  | ||||||
|             if (-1 == result) |  | ||||||
|                 goto exit; |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |         { | ||||||
|             result = fsp_fuse_opt_insert_arg(outargs, 1, "-o", FSP_FUSE_MEMFN_A); |             result = fsp_fuse_opt_insert_arg(outargs, 1, "-o", FSP_FUSE_MEMFN_A); | ||||||
|             if (-1 == result) |             if (-1 == result) | ||||||
|                 goto exit; |                 goto exit; | ||||||
|             result = fsp_fuse_opt_insert_arg(outargs, 2, arg, FSP_FUSE_MEMFN_A); |             result = fsp_fuse_opt_insert_arg(outargs, 2, "", FSP_FUSE_MEMFN_A); | ||||||
|             if (-1 == result) |             if (-1 == result) | ||||||
|                 goto exit; |                 goto exit; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         result = fsp_fuse_opt_add_opt_escaped(&outargs->argv[2], arg, FSP_FUSE_MEMFN_A); | ||||||
|  |         if (-1 == result) | ||||||
|  |             goto exit; | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
| @@ -296,7 +294,7 @@ static int fsp_fuse_opt_process_arg(void *data, | |||||||
|                 s = memalloc(len + 1); |                 s = memalloc(len + 1); | ||||||
|                 if (0 == s) |                 if (0 == s) | ||||||
|                     return -1; |                     return -1; | ||||||
|                 memcpy(s, arg, len); |                 memcpy(s, argl, len); | ||||||
|                 s[len] = '\0'; |                 s[len] = '\0'; | ||||||
|                 VAR(data, opt, const char *) = (const char *)s; |                 VAR(data, opt, const char *) = (const char *)s; | ||||||
|                 return 0; |                 return 0; | ||||||
| @@ -392,13 +390,15 @@ FSP_FUSE_API int fsp_fuse_opt_parse(struct fuse_args *args, void *data, | |||||||
|                 } |                 } | ||||||
|                 else |                 else | ||||||
|                     arg += 2; |                     arg += 2; | ||||||
|                 for (argend = arg;; argend++) |                 for (argend = arg; *arg; argend++) | ||||||
|                 { |                 { | ||||||
|                     if ('\0' == *argend || ',' == *argend) |                     if ('\0' == *argend || ',' == *argend) | ||||||
|                     { |                     { | ||||||
|                         if (-1 == fsp_fuse_opt_parse_arg(data, opts, proc, |                         if (-1 == fsp_fuse_opt_parse_arg(data, opts, proc, | ||||||
|                             arg, argend, 0, 1, &outargs, FSP_FUSE_MEMFN_A)) |                             arg, argend, 0, 1, &outargs, FSP_FUSE_MEMFN_A)) | ||||||
|                             goto fail; |                             goto fail; | ||||||
|  |  | ||||||
|  |                         arg = '\0' == *argend ? argend : argend + 1; | ||||||
|                     } |                     } | ||||||
|                     else if ('\\' == *argend && '\0' != argend[1]) |                     else if ('\\' == *argend && '\0' != argend[1]) | ||||||
|                         argend++; |                         argend++; | ||||||
| @@ -514,7 +514,7 @@ static int fsp_fuse_opt_add_opt_internal(char **opts, const char *opt, int escap | |||||||
|     char *newopts; |     char *newopts; | ||||||
|     const char *p; |     const char *p; | ||||||
|  |  | ||||||
|     optsize = 0 != *opts ? lstrlenA(*opts) + 1 : 0; |     optsize = 0 != *opts && '\0' != (*opts)[0] ? lstrlenA(*opts) + 1 : 0; | ||||||
|     for (p = opt, optlen = 0; *p; p++, optlen++) |     for (p = opt, optlen = 0; *p; p++, optlen++) | ||||||
|         if (escaped && (',' == *p || '\\' == *p)) |         if (escaped && (',' == *p || '\\' == *p)) | ||||||
|             optlen++; |             optlen++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user