public inbox for util-linux@vger.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

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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox