From b04a450df2e54a549f9c7e014016475fa566937b Mon Sep 17 00:00:00 2001 From: Phillip Moore Date: Tue, 19 Oct 2010 08:24:41 -0400 Subject: [PATCH] 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 Change-Id: Ibb6e3f6cee5dccbf9347dfa8bfee8776a7552b91 Reviewed-on: http://gerrit.openafs.org/3005 Reviewed-by: Jeffrey Altman Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/venus/fs.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/venus/fs.c b/src/venus/fs.c index 3c4f2b94e..ae3ceb033 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -4251,20 +4251,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; } -- 2.39.5