summaryrefslogtreecommitdiffstats
path: root/utils/mount/mount.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-08-21 12:19:08 -0400
committerNeil Brown <neilb@suse.de>2007-08-24 13:15:02 +1000
commit29637ac0140db80744b24b0c5d655d435b69ba35 (patch)
tree9dd7233dd390fdb94211f677691ea7e1d44ae490 /utils/mount/mount.c
parenteb6dca418a2f862a5a478d4613e0c70598c93d53 (diff)
downloadnfs-utils-29637ac0140db80744b24b0c5d655d435b69ba35.tar.gz
nfs-utils-29637ac0140db80744b24b0c5d655d435b69ba35.tar.xz
nfs-utils-29637ac0140db80744b24b0c5d655d435b69ba35.zip
mount.nfs: Replace fork() with daemon() for backgrounding mounts
Neil recommended this change to address a problem with background mount processes handling signals properly during an init level change. It is also useful for preventing background mount processes from reporting progress on the parent's tty, which is generally just annoying noise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/mount.c')
-rw-r--r--utils/mount/mount.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 4b78021..2513943 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -550,14 +550,19 @@ int main(int argc, char *argv[])
mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts,
mount_opts, fake, nomtab, FOREGROUND);
if (mnt_err == EX_BG) {
- printf(_("mount: backgrounding \"%s\"\n"), spec);
+ printf(_("%s: backgrounding \"%s\"\n"),
+ progname, spec);
fflush(stdout);
/*
* Parent exits immediately with success.
*/
- if (fork() > 0)
- exit(0);
+ if (daemon(0, 0)) {
+ nfs_error(_("%s: failed to start "
+ "background process: %s\n"),
+ progname, strerror(errno));
+ exit(EX_FAIL);
+ }
mnt_err = try_mount(spec, mount_point, flags, fs_type,
&extra_opts, mount_opts, fake,