aboutsummaryrefslogtreecommitdiffstats
path: root/mount.cifs.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2012-10-08 06:44:49 -0400
committerJeff Layton <jlayton@samba.org>2012-10-08 06:44:49 -0400
commit0705ac30ce5e8a7a7d72253d6ad6e79e73a2bfb0 (patch)
treea546f19921da33516ce5cf9a6804b34cb61c3bff /mount.cifs.c
parent67e0f46bfc39d280986f20c7074039151cb188ba (diff)
downloadcifs-utils-0705ac30ce5e8a7a7d72253d6ad6e79e73a2bfb0.tar.gz
cifs-utils-0705ac30ce5e8a7a7d72253d6ad6e79e73a2bfb0.tar.xz
cifs-utils-0705ac30ce5e8a7a7d72253d6ad6e79e73a2bfb0.zip
mount.cifs: implement the "nofail" option
The mount(8) manpage lists this as a fs-independent option: nofail: Do not report errors for this device if it does not exist. Implement that in mount.cifs by not returning an error if we were unable to find a suitable address for the mount attempt. Reported-by: Peter Trenholme <PTrenholme@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
Diffstat (limited to 'mount.cifs.c')
-rw-r--r--mount.cifs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mount.cifs.c b/mount.cifs.c
index 7ee859b..756fce2 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -159,6 +159,7 @@
#define OPT_CRUID 29
#define OPT_BKUPUID 30
#define OPT_BKUPGID 31
+#define OPT_NOFAIL 32
#define MNT_TMP_FILE "/.mtab.cifs.XXXXXX"
@@ -178,6 +179,7 @@ struct parsed_mount_info {
unsigned int fakemnt:1;
unsigned int nomtab:1;
unsigned int verboseflag:1;
+ unsigned int nofail:1;
};
const char *thisprogram;
@@ -805,6 +807,8 @@ static int parse_opt_token(const char *token)
return OPT_BKUPUID;
if (strncmp(token, "backupgid", 9) == 0)
return OPT_BKUPGID;
+ if (strncmp(token, "nofail", 6) == 0)
+ return OPT_NOFAIL;
return OPT_ERROR;
}
@@ -1177,6 +1181,9 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
bkupgid = gr->gr_gid;
goto nocopy;
+ case OPT_NOFAIL:
+ parsed_info->nofail = 1;
+ goto nocopy;
}
/* check size before copying option to buffer */
@@ -2119,7 +2126,7 @@ int main(int argc, char **argv)
mount_retry:
if (!currentaddress) {
fprintf(stderr, "Unable to find suitable address.\n");
- rc = EX_FAIL;
+ rc = parsed_info->nofail ? 0 : EX_FAIL;
goto mount_exit;
}
strlcpy(options, "ip=", options_size);