Util-Linux package development
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH] libmnt: fix undefined sources
Date: Sat, 06 Aug 2011 20:10:26 -0400	[thread overview]
Message-ID: <1312675826.3408.1.camel@offbook> (raw)

From: Davidlohr Bueso <dave@gnu.org>

The path resolving function breaks when handling undefined sources ("none") used by pseudo-filesystems. The assertion is causing the samples/mount program
to abort:

dave@offbook:~/projects/util-linux-good/libmount/samples$ ./mount
/dev/sda3 on / type ext4 (rw,errors=remount-ro,commit=0)
proc on /proc type proc (rw,noexec,nosuid,nodev)
lt-mount: cache.c:464: mnt_resolve_path: Assertion `path' failed.
Aborted

/etc/mtab:

/dev/sda3 / ext4 rw,errors=remount-ro,commit=0 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
...

Instead of this assert on NULL we can simply return NULL and let mnt_pretty_path do the work.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 libmount/src/cache.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index 802d072..41aa4fe 100644
--- a/libmount/src/cache.c
+++ b/libmount/src/cache.c
@@ -461,8 +461,6 @@ char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
 	char *key = NULL;
 	char *value = NULL;
 
-	assert(path);
-
 	/*DBG(CACHE, mnt_debug_h(cache, "resolving path %s", path));*/
 
 	if (!path)
-- 
1.7.4.1




             reply	other threads:[~2011-08-07  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-07  0:10 Davidlohr Bueso [this message]
2011-08-08 11:54 ` [PATCH] libmnt: fix undefined sources Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312675826.3408.1.camel@offbook \
    --to=dave@gnu.org \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox