Whamcloud - gitweb
b=19720
[fs/lustre-release.git] / lustre / utils / mount_utils.c
index b36a1df..d624656 100644 (file)
@@ -131,8 +131,14 @@ int get_mountdata(char *dev, struct lustre_disk_data *mo_ldd)
         sprintf(filepnm, "%s/mountdata", tmpdir);
         filep = fopen(filepnm, "r");
         if (filep) {
+                size_t num_read;
                 vprint("Reading %s\n", MOUNT_DATA_FILE);
-                fread(mo_ldd, sizeof(*mo_ldd), 1, filep);
+                num_read = fread(mo_ldd, sizeof(*mo_ldd), 1, filep);
+                if (num_read < 1 && ferror(filep)) {
+                        fprintf(stderr, "%s: Unable to read from file (%s): %s\n",
+                                progname, filepnm, strerror(errno));
+                        goto out_close;
+                }
         } else {
                 verrprint("%s: Unable to read %d.%d config %s.\n",
                           progname, LUSTRE_MAJOR, LUSTRE_MINOR, filepnm);