diff options
author | Neil Brown <neilb@suse.de> | 2007-03-20 12:53:32 +1100 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-03-20 12:53:32 +1100 |
commit | b8b6a251c372b134e66d0f436bf2c6231cc1c055 (patch) | |
tree | 22ae6b628493e0f8ff88c9e3dd14f89deef4a718 /utils | |
parent | 4bc447f758ee4d64706b990ac68cb766dbff113c (diff) | |
download | nfs-utils-b8b6a251c372b134e66d0f436bf2c6231cc1c055.tar.gz nfs-utils-b8b6a251c372b134e66d0f436bf2c6231cc1c055.tar.xz nfs-utils-b8b6a251c372b134e66d0f436bf2c6231cc1c055.zip |
mount.nfs - make sure program name in error message is correct.
getopt_long uses argv[0] in error messages. So it it is given
argv+2 for example, we need to make sure that argv[2] has the
correct program name.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mount/mount.c | 3 | ||||
-rw-r--r-- | utils/mount/nfsumount.c | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/utils/mount/mount.c b/utils/mount/mount.c index 71a8737..9ae66f0 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -350,6 +350,7 @@ int main(int argc, char *argv[]) spec = argv[1]; mount_point = argv[2]; + argv[2] = argv[0]; /* so that getopt error messages are correct */ while ((c = getopt_long (argc - 2, argv + 2, "rt:vVwfno:hs", longopts, NULL)) != -1) { switch (c) { @@ -448,7 +449,7 @@ int main(int argc, char *argv[]) if (mount_point == NULL || mount_point[0] != '/') { fprintf(stderr, "%s: unknown mount point %s\n", - progname, argv[2]); + progname, mount_point ? : ""); exit(1); } diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index e101105..81d0d3a 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -288,6 +288,7 @@ int nfsumount(int argc, char *argv[]) argv += 1; argc -= 1; + argv[0] = argv[-1]; /* So that getopt error messages are correct */ while ((c = getopt_long (argc, argv, "fvnrlh", umount_longopts, NULL)) != -1) { |