fs: Catch pioctl failure in mkmount
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 26 Feb 2013 11:55:32 +0000 (11:55 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 26 Feb 2013 15:22:31 +0000 (07:22 -0800)
If the VIOC_FILE_CELL_NAME pioctl fails in fs mkmount, return an
error to the caller, instead of ploughing on with potentially bad
data.

Caught by coverity (#988418)

Change-Id: I68df5dd26d955db860dd016c76109f7d262bad17
Reviewed-on: http://gerrit.openafs.org/9267
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/venus/fs.c

index 5f7e968..d8dc459 100644 (file)
@@ -1931,8 +1931,13 @@ defect #3069
        blob.in_size = 0;
        blob.out_size = AFS_PIOCTL_MAXSIZE;
        blob.out = space;
-       pioctl(Parent(as->parms[0].items->data), VIOC_FILE_CELL_NAME,
-              &blob, 1);
+       code = pioctl(Parent(as->parms[0].items->data), VIOC_FILE_CELL_NAME,
+                     &blob, 1);
+       if (code) {
+          fprintf(stderr,
+                  "%s: couldn't get cell name for file's parent\n", pn);
+          return 1;
+       }
     }
 
     dir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH);