summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2009-02-06 08:23:52 -0500
committerJeff Layton <jlayton@redhat.com>2009-02-06 08:23:52 -0500
commita894bd4504f070233dd2785a62483090581f5bf3 (patch)
treeeb7a7128a8161e3fbe0c8ce6aae2f0ce93d94b94
parent45699a287d27cce24e883384a72441d310c8ee28 (diff)
downloadsamba-a894bd4504f070233dd2785a62483090581f5bf3.tar.gz
mount.cifs: add fakemount (-f) and nomtab (-n) flags to mount.cifs
...so that these options work correctly when passed in by mount(8).
-rw-r--r--source/client/mount.cifs.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 1ac1410e7a0..939db456336 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -71,6 +71,7 @@
const char *thisprogram;
int verboseflag = 0;
+int fakemnt = 0;
static int got_password = 0;
static int got_user = 0;
static int got_domain = 0;
@@ -1018,7 +1019,7 @@ int main(int argc, char ** argv)
char * resolved_path = NULL;
char * temp;
char * dev_name;
- int rc;
+ int rc = 0;
int rsize = 0;
int wsize = 0;
int nomtab = 0;
@@ -1087,8 +1088,8 @@ int main(int argc, char ** argv)
mount_cifs_usage ();
exit(EX_USAGE);
case 'n':
- ++nomtab;
- break;
+ ++nomtab;
+ break;
case 'b':
#ifdef MS_BIND
flags |= MS_BIND;
@@ -1196,6 +1197,9 @@ int main(int argc, char ** argv)
break;
case 't':
break;
+ case 'f':
+ ++fakemnt;
+ break;
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
@@ -1376,8 +1380,7 @@ mount_retry:
/* convert all '\\' to '/' in share portion so that /proc/mounts looks pretty */
replace_char(dev_name, '\\', '/', strlen(share_name));
- if(mount(dev_name, mountpoint, "cifs", flags, options)) {
- /* remember to kill daemon on error */
+ if(!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case 0:
printf("mount failed but no error number set\n");
@@ -1401,6 +1404,8 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");
rc = EX_FAIL;
} else {
+ if (nomtab)
+ goto mount_exit;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {