All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] umount: respect fs search path
@ 2012-02-16 19:59 Mike Frysinger
  2012-02-24 10:36 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2012-02-16 19:59 UTC (permalink / raw)
  To: util-linux-ng

This brings search path support to umount to match existing behavior
in fsck and mount.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 mount/umount.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/mount/umount.c b/mount/umount.c
index ad93e75..a6fcd33 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -100,7 +100,8 @@ static int fake = 0;
 static int
 check_special_umountprog(const char *node,
 			 const char *type, int *status) {
-	char umountprog[120];
+	char search_path[] = FS_SEARCH_PATH;
+	char *path, umountprog[150];
 	struct stat statbuf;
 	int res;
 
@@ -110,10 +111,16 @@ check_special_umountprog(const char *node,
 	if (type == NULL || strcmp(type, "none") == 0)
 		return 0;
 
-	if (strlen(type) < 100) {
+	path = strtok(search_path, ":");
+	while (path) {
 		int type_opt = 0;
 
-		sprintf(umountprog, "/sbin/umount.%s", type);
+		res = snprintf(umountprog, sizeof(umountprog), "%s/umount.%s",
+			       path, type);
+		path = strtok(NULL, ":");
+		if (res < 0 || (size_t) res >= sizeof(umountprog))
+			continue;
+
 		res = stat(umountprog, &statbuf);
 		if (res == -1 && errno == ENOENT && strchr(type, '.')) {
 			/* If type ends with ".subtype" try without it */
-- 
1.7.8.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] umount: respect fs search path
  2012-02-16 19:59 [PATCH] umount: respect fs search path Mike Frysinger
@ 2012-02-24 10:36 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-02-24 10:36 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: util-linux-ng

On Thu, Feb 16, 2012 at 02:59:26PM -0500, Mike Frysinger wrote:
>  mount/umount.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-24 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-16 19:59 [PATCH] umount: respect fs search path Mike Frysinger
2012-02-24 10:36 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.