summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-04 18:47:20 -0800
committerJeremy Allison <jra@samba.org>2007-12-04 18:47:20 -0800
commit786e73e99d2439c6a04ce63474f6c5c9e1b10a91 (patch)
treefb2fe3798ce2de8176139afa1c29f937f9b80b85 /source3
parent65d5d7c59a87b4c12c689a3f8d1a9f64f62d2fec (diff)
downloadsamba-786e73e99d2439c6a04ce63474f6c5c9e1b10a91.tar.gz
samba-786e73e99d2439c6a04ce63474f6c5c9e1b10a91.tar.bz2
samba-786e73e99d2439c6a04ce63474f6c5c9e1b10a91.zip
More pstring removal.
Jeremy. (This used to be commit 905943137c2dafca4dc946f9b1f133fc5542eb37)
Diffstat (limited to 'source3')
-rw-r--r--source3/client/smbmnt.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/source3/client/smbmnt.c b/source3/client/smbmnt.c
index 08dcac8bec..7f1e1d5003 100644
--- a/source3/client/smbmnt.c
+++ b/source3/client/smbmnt.c
@@ -157,10 +157,18 @@ static int mount_ok(char *mount_point)
static int
do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
{
- pstring opts;
+ char *opts;
struct utsname uts;
char *release, *major, *minor;
char *data1, *data2;
+ int ret;
+
+ if (asprintf(&opts,
+ "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
+ mount_uid, mount_gid, data->file_mode,
+ data->dir_mode,options) < 0) {
+ return -1;
+ }
uname(&uts);
release = uts.release;
@@ -176,12 +184,13 @@ do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
data2 = (char *) data;
}
- slprintf(opts, sizeof(opts)-1,
- "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
- mount_uid, mount_gid, data->file_mode, data->dir_mode,options);
- if (mount(share_name, ".", "smbfs", flags, data1) == 0)
+ if (mount(share_name, ".", "smbfs", flags, data1) == 0) {
+ SAFE_FREE(opts);
return 0;
- return mount(share_name, ".", "smbfs", flags, data2);
+ }
+ ret = mount(share_name, ".", "smbfs", flags, data2);
+ SAFE_FREE(opts);
+ return ret;
}
int main(int argc, char *argv[])