mount.cifs: get rid of CONST_DISCARD
authorJeff Layton <jlayton@redhat.com>
Wed, 11 Nov 2009 19:04:54 +0000 (14:04 -0500)
committerJeff Layton <jlayton@redhat.com>
Wed, 11 Nov 2009 19:04:54 +0000 (14:04 -0500)
Apparently, we need to strip the "const" attribute off of the mnt_fstype
before passing it to addmntent to prevent a (somewhat bogus) compiler
warning.

Rather than just stripping off the "const" attribute, clarify the code
by declaring a new non-const char pointer that points to the same
string. We can also use that same pointer in the mount(2) call too.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Matthias Dieter Wallnöfer <mdw@samba.org>
client/mount.cifs.c

index 3baaad793713dbbe224348126cd57042f6d002f6..a9c18279178d6092a7b70598572e66a7c4b55dba 100644 (file)
@@ -76,8 +76,6 @@
 
 #define MAX_UNC_LEN 1024
 
 
 #define MAX_UNC_LEN 1024
 
-#define CONST_DISCARD(type, ptr)      ((type) ((void *) (ptr)))
-
 #ifndef SAFE_FREE
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 #endif
 #ifndef SAFE_FREE
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 #endif
@@ -123,6 +121,7 @@ static char * user_name = NULL;
 static char * mountpassword = NULL;
 char * domain_name = NULL;
 char * prefixpath = NULL;
 static char * mountpassword = NULL;
 char * domain_name = NULL;
 char * prefixpath = NULL;
+char *cifs_fstype = "cifs";
 
 /* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We
  * don't link to libreplace so need them here. */
 
 /* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We
  * don't link to libreplace so need them here. */
@@ -1590,7 +1589,7 @@ mount_retry:
        if (verboseflag)
                fprintf(stderr, "\n");
 
        if (verboseflag)
                fprintf(stderr, "\n");
 
-       if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
+       if (!fakemnt && mount(dev_name, mountpoint, cifs_fstype, flags, options)) {
                switch (errno) {
                case ECONNREFUSED:
                case EHOSTUNREACH:
                switch (errno) {
                case ECONNREFUSED:
                case EHOSTUNREACH:
@@ -1638,7 +1637,7 @@ mount_retry:
        }
        mountent.mnt_fsname = dev_name;
        mountent.mnt_dir = mountpoint;
        }
        mountent.mnt_fsname = dev_name;
        mountent.mnt_dir = mountpoint;
-       mountent.mnt_type = CONST_DISCARD(char *,"cifs");
+       mountent.mnt_type = cifs_fstype;
        mountent.mnt_opts = (char *)malloc(220);
        if(mountent.mnt_opts) {
                char * mount_user = getusername();
        mountent.mnt_opts = (char *)malloc(220);
        if(mountent.mnt_opts) {
                char * mount_user = getusername();