forked from pool/systemd
9fc3254595
- Update of patch 0001-detect-s390-virt.patch (bnc#880438) - Shut up stupid check scripts crying for not mentioned systemd-mini-rpmlintrc - Add upstream patchs 0001-core-use-correct-format-string-for-UIDs.patch 0002-core-transaction-fix-cycle-break-attempts-outside-tr.patch 0003-fsck-consider-a-fsck-implementation-linked-to-bin-tr.patch - Add upstream patch 0001-units-order-network-online.target-after-network.targ.patch to make sure that etwork-online.target follows network.target - rules: re-enable dev_id conditionally in persistent rules (bnc#884403 and bnc#882714). Add 1040-re-enable-dev_id-conditionally-in-persistent-rules.patch - Add upstream patches 0001-vconsole-also-copy-character-maps-not-just-fonts-fro.patch 0002-core-make-sure-Environment-fields-passed-in-for-tran.patch 0003-core-You-can-not-put-the-cached-result-of-use_smack-.patch 0004-cryptsetup-don-t-add-unit-dependency-on-dev-null-dev.patch 0005-man-fix-path-in-crypttab-5.patch - Add upstream patch 1039-udevadm-settle-fixed-return-code-for-empty-queue.patch it fixes udevadm settle exit code which may had roken dracut scripts (bnc#884271 comment#18) - Temporary disable patch 1022 (bnc#884271 and bnc#882714). OBS-URL: https://build.opensuse.org/request/show/238853 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=190
120 lines
4.3 KiB
Diff
120 lines
4.3 KiB
Diff
From c3544e8d2c2d870a2aff0944aff4ab7824b9ae6b Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Thu, 5 Jun 2014 21:35:15 +0200
|
|
Subject: [PATCH] umount: modernizations
|
|
|
|
---
|
|
src/core/umount.c | 65 ++++++++++++++++++++++-------------------------------
|
|
1 file changed, 27 insertions(+), 38 deletions(-)
|
|
|
|
diff --git src/core/umount.c src/core/umount.c
|
|
index d1258f0..a30f674 100644
|
|
--- src/core/umount.c
|
|
+++ src/core/umount.c
|
|
@@ -61,52 +61,46 @@ static void mount_points_list_free(MountPoint **head) {
|
|
}
|
|
|
|
static int mount_points_list_get(MountPoint **head) {
|
|
- FILE *proc_self_mountinfo;
|
|
- char *path, *p;
|
|
+ _cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
|
|
unsigned int i;
|
|
- int r;
|
|
|
|
assert(head);
|
|
|
|
- if (!(proc_self_mountinfo = fopen("/proc/self/mountinfo", "re")))
|
|
+ proc_self_mountinfo = fopen("/proc/self/mountinfo", "re");
|
|
+ if (!proc_self_mountinfo)
|
|
return -errno;
|
|
|
|
for (i = 1;; i++) {
|
|
- int k;
|
|
+ _cleanup_free_ char *path = NULL;
|
|
+ char *p = NULL;
|
|
MountPoint *m;
|
|
+ int k;
|
|
|
|
- path = p = NULL;
|
|
-
|
|
- if ((k = fscanf(proc_self_mountinfo,
|
|
- "%*s " /* (1) mount id */
|
|
- "%*s " /* (2) parent id */
|
|
- "%*s " /* (3) major:minor */
|
|
- "%*s " /* (4) root */
|
|
- "%ms " /* (5) mount point */
|
|
- "%*s" /* (6) mount options */
|
|
- "%*[^-]" /* (7) optional fields */
|
|
- "- " /* (8) separator */
|
|
- "%*s " /* (9) file system type */
|
|
- "%*s" /* (10) mount source */
|
|
- "%*s" /* (11) mount options 2 */
|
|
- "%*[^\n]", /* some rubbish at the end */
|
|
- &path)) != 1) {
|
|
+ k = fscanf(proc_self_mountinfo,
|
|
+ "%*s " /* (1) mount id */
|
|
+ "%*s " /* (2) parent id */
|
|
+ "%*s " /* (3) major:minor */
|
|
+ "%*s " /* (4) root */
|
|
+ "%ms " /* (5) mount point */
|
|
+ "%*s" /* (6) mount options */
|
|
+ "%*[^-]" /* (7) optional fields */
|
|
+ "- " /* (8) separator */
|
|
+ "%*s " /* (9) file system type */
|
|
+ "%*s" /* (10) mount source */
|
|
+ "%*s" /* (11) mount options 2 */
|
|
+ "%*[^\n]", /* some rubbish at the end */
|
|
+ &path);
|
|
+ if (k != 1) {
|
|
if (k == EOF)
|
|
break;
|
|
|
|
log_warning("Failed to parse /proc/self/mountinfo:%u.", i);
|
|
-
|
|
- free(path);
|
|
continue;
|
|
}
|
|
|
|
p = cunescape(path);
|
|
- free(path);
|
|
-
|
|
- if (!p) {
|
|
- r = -ENOMEM;
|
|
- goto finish;
|
|
- }
|
|
+ if (!p)
|
|
+ return -ENOMEM;
|
|
|
|
/* Ignore mount points we can't unmount because they
|
|
* are API or because we are keeping them open (like
|
|
@@ -118,22 +112,17 @@ static int mount_points_list_get(MountPoint **head) {
|
|
continue;
|
|
}
|
|
|
|
- if (!(m = new0(MountPoint, 1))) {
|
|
+ m = new0(MountPoint, 1);
|
|
+ if (!m) {
|
|
free(p);
|
|
- r = -ENOMEM;
|
|
- goto finish;
|
|
+ return -ENOMEM;
|
|
}
|
|
|
|
m->path = p;
|
|
LIST_PREPEND(mount_point, *head, m);
|
|
}
|
|
|
|
- r = 0;
|
|
-
|
|
-finish:
|
|
- fclose(proc_self_mountinfo);
|
|
-
|
|
- return r;
|
|
+ return 0;
|
|
}
|
|
|
|
static int swap_list_get(MountPoint **head) {
|
|
--
|
|
1.7.9.2
|
|
|