Skip to content

Commit 3e1f5e9

Browse files
probonopdTheAssassin
authored andcommitted
Increase verbosity of fuse mount related operations
1 parent 5085952 commit 3e1f5e9

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/runtime/runtime.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ int appimage_print_binary(char* fname, unsigned long offset, unsigned long lengt
409409
return 0;
410410
}
411411

412-
char* find_fusermount() {
412+
char* find_fusermount(bool verbose) {
413413
char* fusermount_base = "fusermount";
414414

415415
char* fusermount_path = getenv("PATH");
@@ -452,11 +452,17 @@ char* find_fusermount() {
452452
}
453453

454454
if (sb.st_uid != 0 || (sb.st_mode & S_ISUID) == 0) {
455-
// Not setuid root, skip this binary
455+
if (verbose) {
456+
printf("Not setuid root, skipping...\n");
457+
}
456458
free(fusermount_full_path);
457459
continue;
458460
}
459461

462+
if (verbose) {
463+
printf("Found setuid root executable: %s\n", fusermount_full_path);
464+
}
465+
460466
pid_t pid = fork();
461467
if (pid == -1) {
462468
perror("fork");
@@ -1486,6 +1492,8 @@ int main(int argc, char* argv[]) {
14861492
exit(0);
14871493
}
14881494

1495+
const bool verbose = (getenv("VERBOSE") != NULL);
1496+
14891497
/* extract the AppImage */
14901498
if (arg && strcmp(arg, "appimage-extract") == 0) {
14911499
char* pattern;
@@ -1501,8 +1509,6 @@ int main(int argc, char* argv[]) {
15011509
exit(1);
15021510
}
15031511

1504-
const bool verbose = (getenv("VERBOSE") != NULL);
1505-
15061512
if (!extract_appimage(appimage_path, "squashfs-root/", pattern, true, verbose)) {
15071513
exit(1);
15081514
}
@@ -1564,8 +1570,6 @@ int main(int argc, char* argv[]) {
15641570
strcat(prefix, hexlified_digest);
15651571
free(hexlified_digest);
15661572

1567-
const bool verbose = (getenv("VERBOSE") != NULL);
1568-
15691573
if (!extract_appimage(appimage_path, prefix, NULL, false, verbose)) {
15701574
fprintf(stderr, "Failed to extract AppImage\n");
15711575
exit(EXIT_EXECERROR);
@@ -1647,7 +1651,7 @@ int main(int argc, char* argv[]) {
16471651
appimage_print_binary(appimage_path, offset, length);
16481652
exit(0);
16491653
}
1650-
1654+
16511655
portable_option(arg, appimage_path, "home");
16521656
portable_option(arg, appimage_path, "config");
16531657

@@ -1693,10 +1697,12 @@ int main(int argc, char* argv[]) {
16931697

16941698
fusermountPath = getenv("FUSERMOUNT_PROG");
16951699
if (fusermountPath == NULL) {
1696-
char* new_prog = find_fusermount();
1700+
char* new_prog = find_fusermount(verbose);
16971701
if (new_prog != NULL) {
16981702
setenv("FUSERMOUNT_PROG", new_prog, 1);
1699-
// printf("FUSERMOUNT_PROG set to %s\n", new_prog);
1703+
if (verbose) {
1704+
fprintf(stderr, "FUSERMOUNT_PROG set to %s\n", new_prog);
1705+
}
17001706
free(new_prog);
17011707
} else {
17021708
printf("Error: No suitable fusermount binary found on the $PATH\n");

0 commit comments

Comments
 (0)