diff options
author | Michael Adam <obnox@samba.org> | 2009-10-08 10:44:48 -0400 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-10-12 11:47:26 +0200 |
commit | 89cc728e44b0cec6fe122b7e650f22447d251b7a (patch) | |
tree | dbd0d445db12af035c8e99f0ab2bb2e7b6ccd180 | |
parent | d7607eb74658cae4856bb287242bc6f5fb27438b (diff) | |
download | samba-89cc728e44b0cec6fe122b7e650f22447d251b7a.tar.gz samba-89cc728e44b0cec6fe122b7e650f22447d251b7a.tar.xz samba-89cc728e44b0cec6fe122b7e650f22447d251b7a.zip |
s3:mount.cifs: make "mount.cifs -V" print the version, not usage.
(cherry-picked from d7ca4997017e86b6f23ced64f1f1672bfb15716b)
Also make "mount.cifs -h" not exit with error exit code but with return code 0.
Michael
Part 2/2 of a fix for bug #6692 (mount.cifs segfault).
(cherry picked from commit d41131948346619be98514331d7059d9bffecac5)
-rw-r--r-- | source/client/mount.cifs.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c index bb40a8cfc3a..0add7a8d39e 100644 --- a/source/client/mount.cifs.c +++ b/source/client/mount.cifs.c @@ -1036,6 +1036,14 @@ uppercase_string(char *string) return 1; } +static void print_cifs_mount_version(void) +{ + printf("mount.cifs version: %s.%s%s\n", + MOUNT_CIFS_VERSION_MAJOR, + MOUNT_CIFS_VERSION_MINOR, + MOUNT_CIFS_VENDOR_SUFFIX); +} + int main(int argc, char ** argv) { int c; @@ -1097,6 +1105,24 @@ int main(int argc, char ** argv) exit(EX_SYSERR); } mountpoint = argv[2]; + } else if (argc == 2) { + if ((strcmp(argv[1], "-V") == 0) || + (strcmp(argv[1], "--version") == 0)) + { + print_cifs_mount_version(); + exit(0); + } + + if ((strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "-?") == 0) || + (strcmp(argv[1], "--help") == 0)) + { + mount_cifs_usage(); + exit(0); + } + + mount_cifs_usage(); + exit(EX_USAGE); } else { mount_cifs_usage(); exit(EX_USAGE); @@ -1153,11 +1179,8 @@ int main(int argc, char ** argv) case 'v': ++verboseflag; break; - case 'V': - printf ("mount.cifs version: %s.%s%s\n", - MOUNT_CIFS_VERSION_MAJOR, - MOUNT_CIFS_VERSION_MINOR, - MOUNT_CIFS_VENDOR_SUFFIX); + case 'V': + print_cifs_mount_version(); exit (0); case 'w': flags &= ~MS_RDONLY; |