aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mount_smbfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mount_smbfs.c')
-rw-r--r--modules/mount_smbfs.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/mount_smbfs.c b/modules/mount_smbfs.c
index 811fe8d..472b961 100644
--- a/modules/mount_smbfs.c
+++ b/modules/mount_smbfs.c
@@ -7,7 +7,7 @@
*
* Mount point input format expected is: //server/service[/root_path...]
*
- * Copyright 1997 Transmeta Corporation - All Rights Reserved
+ * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -136,14 +136,21 @@ int mount_mount(const char *root, const char *name, int name_len,
const char **argv;
fullpath = alloca(strlen(root)+name_len+2);
- optcopy = alloca(optsize = strlen(options)+1);
- if ( !fullpath || !optcopy ) {
+ if (options)
+ optcopy = alloca(optsize = strlen(options)+1);
+ else {
+ optsize = 0;
+ optcopy = NULL;
+ }
+ if ( !fullpath || (!optcopy && optsize)) {
syslog(LOG_ERR, MODPREFIX "alloca: %m");
return 1;
}
sprintf(fullpath, "%s/%s", root, name);
- memcpy(optcopy, options, optsize);
+ if (optsize)
+ memcpy(optcopy, options, optsize);
+
argc = smb_parse_options(optcopy, NULL, NULL, &qbuflen) + 4;
argv = alloca(sizeof(char *) * argc);
qbuf = alloca(qbuflen);
@@ -154,7 +161,8 @@ int mount_mount(const char *root, const char *name, int name_len,
argv[0] = PATH_SMBMOUNT;
argv[1] = what;
argv[2] = fullpath;
- memcpy(optcopy, options, optsize);
+ if (optsize)
+ memcpy(optcopy, options, optsize);
smb_parse_options(optcopy, argv+3, qbuf, NULL);
syslog(LOG_DEBUG, MODPREFIX "calling mkdir %s", fullpath);