[SSI] openssi/util-linux/mount mount.c,1.1.15.1,1.1.15.2
Roger Tsang <[email protected]> Sun, 15 Aug 2010 03:36:58 +0000
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/util-linux/mount
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv14374/mount
Modified Files:
Tag: CENTOS
mount.c
Log Message:
Update to util-linux-2.12a-24.el4_8.1.src.rpm
Index: mount.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/util-linux/mount/Attic/mount.c,v
retrieving revision 1.1.15.1
retrieving revision 1.1.15.2
diff -u -d -r1.1.15.1 -r1.1.15.2
--- mount.c 4 Jul 2010 21:00:02 -0000 1.1.15.1
+++ mount.c 15 Aug 2010 03:36:56 -0000 1.1.15.2
@@ -743,6 +743,25 @@
else {
mntFILE *mfp;
+ /* when moving a mount point, we have to make sure the mtab
+ * gets updated properly. We get info about the old mount
+ * point, copy it to the new mount point, and then delete
+ * the old mount point. */
+ if (flags & MS_MOVE) {
+ const char *olddir = mnt.mnt_fsname;
+ struct mntentchn *oldmc = oldmc = getmntfile(olddir);
+ if (oldmc != NULL) {
+ mnt.mnt_fsname = strdup(oldmc->m.mnt_fsname);
+ mnt.mnt_type = oldmc->m.mnt_type;
+ mnt.mnt_opts = oldmc->m.mnt_opts;
+ mnt.mnt_freq = oldmc->m.mnt_freq;
+ mnt.mnt_passno = oldmc->m.mnt_passno;
+ }
+ update_mtab(olddir, NULL);
+ if (oldmc != NULL)
+ free(olddir);
+ }
+
lock_mtab();
mfp = my_setmntent(MOUNTED, "a+");
if (mfp == NULL || mfp->mntent_fp == NULL) {
@@ -1205,6 +1224,26 @@
}
}
+/*
+ * have process detach from controlling terminal, and chdir to the root
+ */
+static void
+detach_terminal(void)
+{
+ int i, fd;
+
+ chdir("/");
+
+ fd = open("/dev/null", O_RDWR);
+ if (fd < 0)
+ return;
+
+ for (i = 0; i < 3; i++)
+ dup2(fd, i);
+
+ close(fd);
+ return;
+}
/*
* Return 0 for success (either mounted sth or -a and NOAUTO was given)
@@ -1298,6 +1337,7 @@
types = xstrdup(types);
opts = xstrdup(opts);
set_proc_name (spec); /* make a nice "ps" listing */
+ detach_terminal();
status2 = try_mount_one (spec, node, types, opts, freq, pass, 1, 0);
if (verbose && status2)
printf (_("mount: giving up \"%s\"\n"), spec);
@@ -1312,8 +1352,15 @@
if (!strncmp(spec, "UUID=", 5))
nspec = get_spec_by_uuid(spec+5);
- else if (!strncmp(spec, "LABEL=", 6))
- nspec = get_spec_by_volume_label(spec+6);
+ else if (!strncmp(spec, "LABEL=", 6)) {
+ struct labelDev *ld = all_occurrence_of_vol_label(spec+6);
+
+ nspec = (char *) resolve_duplicate_label(ld);
+ if (nspec)
+ nspec = xstrdup(nspec);
+ if (ld)
+ free_label_dev(ld);
+ }
if (nspec)
spec = nspec;
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev