]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Makes fs getfid error handling consistent with other fs commands
authorPhillip Moore <w.phillip.moore@gmail.com>
Tue, 19 Oct 2010 12:24:41 +0000 (08:24 -0400)
committerDerrick Brashear <shadow@dementia.org>
Wed, 3 Nov 2010 10:49:48 +0000 (03:49 -0700)
This patch makes the fs getfid command print errors for paths that
can't be handled correctly, instead of quietly ignoring them, and it
also returns an error code if any such paths are encountered.  This
makes the behavior consistent with other fs commands, such as
listquota, whereis, etc.

FIXES 128372

Reviewed-on: http://gerrit.openafs.org/3005
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b04a450df2e54a549f9c7e014016475fa566937b)
Change-Id: I63ae7edeff59bcd264a371c3bfd71220da4b4a39
Reviewed-on: http://gerrit.openafs.org/3229

src/venus/fs.c

index 59998ee20627bd9f4c34784e2a9a6ccfc4c241a2..22e6e8468c3b21bc5ddbf00756105c2f308fe93e 100644 (file)
@@ -4256,20 +4256,30 @@ GetFidCmd(struct cmd_syndesc *as, void *arock)
 {
     struct ViceIoctl blob;
     struct cmd_item *ti;
+
+    afs_int32 code;
+    int error = 0;
+
     for (ti = as->parms[0].items; ti; ti = ti->next) {
-      struct VenusFid vfid;
+        struct VenusFid vfid;
 
-      blob.out_size = sizeof(struct VenusFid);
-      blob.out = (char *) &vfid;
-      blob.in_size = 0;
+        blob.out_size = sizeof(struct VenusFid);
+        blob.out = (char *) &vfid;
+        blob.in_size = 0;
+
+        code = pioctl(ti->data, VIOCGETFID, &blob, 1);
+        if (code) {
+            Die(errno,ti->data);
+            error = 1;
+            continue;
+        }
+
+        printf("File %s (%u.%u.%u) contained in volume %u\n",
+               ti->data, vfid.Fid.Volume, vfid.Fid.Vnode, vfid.Fid.Unique,
+               vfid.Fid.Volume);
 
-      if (0 == pioctl(ti->data, VIOCGETFID, &blob, 1)) {
-       printf("File %s (%u.%u.%u) contained in volume %u\n",
-              ti->data, vfid.Fid.Volume, vfid.Fid.Vnode, vfid.Fid.Unique,
-              vfid.Fid.Volume);
-      }
     }
 
-    return 0;
+    return error;
 }