linamh/sys-fs/posixovl/files/0001-fix-mount-option-bug-and-compile-warnings.patch
Mario Fetka 20ef8b5c88 Bump
2024-06-18 10:44:56 +02:00

75 lines
1.7 KiB
Diff

Description: Fix compile warnings and a mount option bug
Forwarded: not-needed
--- a/posixovl.c
+++ b/posixovl.c
@@ -195,7 +195,7 @@
static char *strlcpy(char *dest, const char *src, size_t n)
{
- strncpy(dest, src, n);
+ strncpy(dest, src, n-1);
dest[n-1] = '\0';
return dest;
}
@@ -2011,8 +2011,9 @@
char **aptr, **new_argv;
int new_argc = 0, original_wd, c;
char xargs[256];
+ char *mount_option = NULL;
- while ((c = getopt(argc, argv, "1FHS:")) > 0) {
+ while ((c = getopt(argc, argv, "1FHS:o:")) > 0) {
switch (c) {
case '1':
single_threaded = true;
@@ -2026,6 +2027,9 @@
case 'S':
root_dir = optarg;
break;
+ case 'o':
+ mount_option = optarg;
+ break;
default:
usage(*argv);
return EXIT_FAILURE;
@@ -2035,7 +2039,12 @@
if (argv[optind] == NULL)
usage(*argv);
if (root_dir == NULL)
+ {
root_dir = argv[optind];
+ /* If there is another one, it is a target path. */
+ if (optind + 1 < argc)
+ optind++;
+ }
umask(0);
if ((root_fd = open(root_dir, O_DIRECTORY)) < 0) {
@@ -2046,7 +2055,7 @@
original_wd = open(".", O_DIRECTORY);
- new_argv = malloc(sizeof(char *) * (argc + 5 - optind));
+ new_argv = malloc(sizeof(char *) * (argc + 7 - optind));
new_argv[new_argc++] = argv[0];
#ifdef HAVE_JUST_FUSE_2_6_5
snprintf(xargs, sizeof(xargs),
@@ -2063,9 +2072,16 @@
new_argv[new_argc++] = "-oallow_other";
if (single_threaded)
new_argv[new_argc++] = "-s";
+ if (mount_option != NULL)
+ {
+ new_argv[new_argc++] = "-o";
+ new_argv[new_argc++] = mount_option;
+ }
for (aptr = &argv[optind]; *aptr != NULL; ++aptr)
+ {
new_argv[new_argc++] = *aptr;
+ }
new_argv[new_argc] = NULL;
c = fuse_main(new_argc, (char **)new_argv, &posixovl_ops, NULL);