From: Phillip Moore Date: Tue, 19 Oct 2010 12:24:41 +0000 (-0400) Subject: Makes fs getfid error handling consistent with other fs commands X-Git-Tag: openafs-devel-1_5_78~18 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=7667610bfa2912e3d5cd9b37174d74c901dca75d;p=packages%2Fo%2Fopenafs.git Makes fs getfid error handling consistent with other fs commands 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 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit b04a450df2e54a549f9c7e014016475fa566937b) Change-Id: I63ae7edeff59bcd264a371c3bfd71220da4b4a39 Reviewed-on: http://gerrit.openafs.org/3229 --- diff --git a/src/venus/fs.c b/src/venus/fs.c index 59998ee20..22e6e8468 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -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; }