summaryrefslogtreecommitdiffstats
path: root/mount/fstab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mount/fstab.c')
-rw-r--r--mount/fstab.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/mount/fstab.c b/mount/fstab.c
index 09b5f584d..1a7ce4e58 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -11,7 +11,8 @@
#include <sys/stat.h>
#include "mntent.h"
#include "fstab.h"
-#include "sundries.h" /* for xmalloc() etc */
+#include "sundries.h"
+#include "xmalloc.h"
#include "mount_blkid.h"
#include "paths.h"
#include "nls.h"
@@ -411,6 +412,15 @@ setlkw_timeout (int sig) {
/* nothing, fcntl will fail anyway */
}
+/* Remove lock file. */
+void
+unlock_mtab (void) {
+ if (we_created_lockfile) {
+ unlink (MOUNTED_LOCK);
+ we_created_lockfile = 0;
+ }
+}
+
/* Create the lock file.
The lock file will be removed if we catch a signal or when we exit. */
/* The old code here used flock on a lock file /etc/mtab~ and deleted
@@ -436,6 +446,8 @@ lock_mtab (void) {
int tries = 3;
char linktargetfile[MOUNTLOCK_LINKTARGET_LTH];
+ at_die = unlock_mtab;
+
if (!signals_have_been_setup) {
int sig = 0;
struct sigaction sa;
@@ -543,15 +555,6 @@ lock_mtab (void) {
}
}
-/* Remove lock file. */
-void
-unlock_mtab (void) {
- if (we_created_lockfile) {
- unlink (MOUNTED_LOCK);
- we_created_lockfile = 0;
- }
-}
-
/*
* Update the mtab.
* Used by umount with null INSTEAD: remove the last DIR entry.