diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2009-10-11 11:32:24 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2009-10-11 11:32:24 +0000 |
commit | 729c77bda0bfac411a15752f6d571eba7366ce28 (patch) | |
tree | 9d6f7bbccb9fa7c92288a11c559ab4d6461786c7 /libgphoto2/gphoto2-setting.c | |
parent | d0a3f9095046be3f564edbdf7966454e77b83292 (diff) | |
download | libgphoto2-729c77bda0bfac411a15752f6d571eba7366ce28.tar.gz |
check for fgets return value
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12488 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-setting.c')
-rw-r--r-- | libgphoto2/gphoto2-setting.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libgphoto2/gphoto2-setting.c b/libgphoto2/gphoto2-setting.c index ab045e5d2..7f2ad3102 100644 --- a/libgphoto2/gphoto2-setting.c +++ b/libgphoto2/gphoto2-setting.c @@ -142,7 +142,8 @@ verify_settings (char *settings_file) rewind(f); while (!feof(f)) { strcpy(buf, ""); - fgets(buf, 1023, f); + if (!fgets(buf, 1023, f)) + break; buf[strlen(buf)] = 0; if (strlen(buf)>2) { equals = 0; @@ -200,7 +201,8 @@ load_settings (void) rewind(f); while (!feof(f)) { strcpy(buf, ""); - fgets(buf, 1023, f); + if (!fgets(buf, 1023, f)) + break; if (strlen(buf)>2) { buf[strlen(buf)-1] = '\0'; id = strtok(buf, "="); |