From 312d60ce78761ea3e6de866ac6fd7e4eee79b42a Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Sat, 6 Aug 2011 08:50:09 -0700 Subject: [PATCH] fix up mount debugging * give the stat return code in a print statment * make sure to give the examined mount back, not the empty eyefi_mount --- eyefi-linux.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eyefi-linux.c b/eyefi-linux.c index d3e2c03..d752fd5 100644 --- a/eyefi-linux.c +++ b/eyefi-linux.c @@ -77,6 +77,7 @@ char *locate_eyefi_mount(void) char mnt[LINEBUFSZ]; char fs[LINEBUFSZ]; char opt[LINEBUFSZ]; + int fs_nr = -1; int foo; int bar; @@ -87,12 +88,14 @@ char *locate_eyefi_mount(void) while (fgets(&line[0], 1023, mounts)) { int read; + fs_nr++; read = sscanf(&line[0], "%s %s %s %s %d %d", &dev[0], &mnt[0], &fs[0], &opt[0], &foo, &bar); // only look at fat filesystems: if (strcmp(fs, "msdos") && strcmp(fs, "vfat")) { - debug_printf(4, "fs at '%s' is not fat, skipping...\n", mnt); + debug_printf(4, "fs[%d] at '%s' is not fat, skipping...\n", + fs_nr, mnt); continue; } // Linux's /proc/mounts has spaces like this \040 @@ -105,8 +108,9 @@ char *locate_eyefi_mount(void) statret = stat(file, &statbuf); free(file); if (statret) { - debug_printf(4, "fs at: %s is not an Eye-Fi card, skipping...\n", - eyefi_mount); + debug_printf(3, "fs[%d] at: %s is not an Eye-Fi card, skipping...\n", + fs_nr, &mnt[0]); + debug_printf(4, "statret: %d\n", statret); continue; } strcpy(&eyefi_mount[0], &mnt[0]);