| 4410 | |
| 4411 | #if defined(__APPLE__) || defined(__DARWIN__) |
| 4412 | /* If the volume has a volume name, then append the MacFUSE-specific |
| 4413 | * 'volname' option, making the volume name appear in Finder. */ |
| 4414 | if (ctx->vol->vol_name) { |
| 4415 | int i; |
| 4416 | size_t vol_name_len = strlen(ctx->vol->vol_name); |
| 4417 | char *scrubbed_vol_name = |
| 4418 | calloc(1, sizeof(char) * (vol_name_len + 1)); |
| 4419 | if (scrubbed_vol_name == NULL) |
| 4420 | goto err_out; |
| 4421 | |
| 4422 | /* Scrub all ',' characters from the volume name since they |
| 4423 | * would interfere with FUSE argument delimiters. */ |
| 4424 | for (i = 0; i < vol_name_len; ++i) { |
| 4425 | char cur = ctx->vol->vol_name[i]; |
| 4426 | if(cur == ',') |
| 4427 | scrubbed_vol_name[i] = '_'; |
| 4428 | else |
| 4429 | scrubbed_vol_name[i] = cur; |
| 4430 | } |
| 4431 | |
| 4432 | scrubbed_vol_name[i] = '\0'; |
| 4433 | |
| 4434 | if (strappend(&parsed_options, ",volname=")) |
| 4435 | goto err_out; |
| 4436 | if (strappend(&parsed_options, scrubbed_vol_name)) |
| 4437 | goto err_out; |
| 4438 | |
| 4439 | free(scrubbed_vol_name); |
| 4440 | } |
| 4441 | #endif /* defined(__APPLE__) || defined(__DARWIN__) */ |