From 9724df2ec5db5afbb6d60a52d930270fb13b673f Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Wed, 12 Jul 2017 15:07:27 -0400 Subject: [PATCH] LU-5170 lfs: Standardize error messages in lfs_path2fid() Error messages in lfs_path2fid() are updated to a standard format. Messages are prefixed with the name of the utility and the command that caused the error. User-provided values are delimited with single quotes. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: I32ab8650ddced9569837aa3d106ef1708c974bce Reviewed-on: https://review.whamcloud.com/30670 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Nunez --- lustre/utils/lfs.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index bf7bb98..321975f 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -6582,14 +6582,18 @@ static int lfs_path2fid(int argc, char **argv) show_parents = true; break; default: - fprintf(stderr, "error: %s: option '%s' unrecognized\n", - argv[0], argv[optind - 1]); + fprintf(stderr, + "%s path2fid: unrecognized option '%s'\n", + progname, argv[optind - 1]); return CMD_HELP; } } - if (optind > argc - 1) + if (optind > argc - 1) { + fprintf(stderr, "%s path2fid: FILE... must be specified\n", + progname); return CMD_HELP; + } else if (optind < argc - 1) sep = ": "; @@ -6624,8 +6628,9 @@ static int lfs_path2fid(int argc, char **argv) } if (err) { - fprintf(stderr, "%s: can't get %sfid for %s: %s\n", - argv[0], show_parents ? "parent " : "", *path, + fprintf(stderr, + "%s path2fid: cannot get %sfid for '%s': %s\n", + progname, show_parents ? "parent " : "", *path, strerror(-err)); if (rc == 0) { rc = err; -- 1.8.3.1