ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From 424873fd1c78edd597a02cbf4a402450369b0905 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@zonque.org>
Date: Thu, 4 Jun 2015 15:39:49 +0200
Subject: [PATCH] core/mount: skip incomplete mountinfo entries

Skip /proc/mountinfo entries for which libmount returns a NULL pointer
for 'source' or 'target'. This happened on Semaphore CI's build servers
when the test suite is run.

(cherry picked from commit c0a7f8d3cb757cf750fc6788df0d215f6457c09d)
---
 src/core/mount.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/core/mount.c b/src/core/mount.c
index ba1dcf1e85..851b41351e 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1522,6 +1522,9 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
                 options = mnt_fs_get_options(fs);
                 fstype = mnt_fs_get_fstype(fs);
 
+                if (!device || !path)
+                        continue;
+
                 if (cunescape(device, UNESCAPE_RELAX, &d) < 0)
                         return log_oom();