]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:mount.cifs: make "mount.cifs -V" print the version, not usage.
authorMichael Adam <obnox@samba.org>
Thu, 8 Oct 2009 14:44:48 +0000 (10:44 -0400)
committerKarolin Seeger <kseeger@samba.org>
Fri, 9 Oct 2009 06:27:20 +0000 (08:27 +0200)
(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).

source/client/mount.cifs.c

index bb40a8cfc3a5c451ecfad758e09fb0864fc900f9..0add7a8d39e06b2b81c6049d31b2b5acc278b09e 100644 (file)
@@ -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;