FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 10-10-2012, 09:44 PM
Matthias Großmann
 
Default Bug#661527: Apparently a bug in libmount1

I think this is a bug in libmount1. The function mnt_chdir_to_parent() in
util-linux-2.20.1/libmount/src/utils.c fails to handle paths of the form
/dir correctly. The following patch for the source package util-linux should
fix this:

--- util-linux-2.20.1.orig/libmount/src/utils.c 2011-10-18 07:41:47.000000000 +0200
+++ util-linux-2.20.1/libmount/src/utils.c 2012-10-10 21:07:40.559854007 +0200
@@ -69,7 +69,7 @@
*/
int mnt_chdir_to_parent(const char *target, char **filename)
{
- char *path, *last = NULL;
+ char *path, *path2, *last = NULL;
char cwd[PATH_MAX];
int rc = -EINVAL;

@@ -85,11 +85,14 @@
if (!last)
goto err;
}
- if (!*path)
- *path = '/'; /* root */

- if (chdir(path) == -1) {
- DBG(UTILS, mnt_debug("failed to chdir to %s: %m", path));
+ if (*path)
+ path2 = path;
+ else
+ path2 = "/"; /* root */
+
+ if (chdir(path2) == -1) {
+ DBG(UTILS, mnt_debug("failed to chdir to %s: %m", path2));
rc = -errno;
goto err;
}
@@ -98,12 +101,12 @@
rc = -errno;
goto err;
}
- if (strcmp(cwd, path) != 0) {
- DBG(UTILS, mnt_debug("path moved (%s -> %s)", path, cwd));
+ if (strcmp(cwd, path2) != 0) {
+ DBG(UTILS, mnt_debug("path moved (%s -> %s)", path2, cwd));
goto err;
}

- DBG(CXT, mnt_debug("current directory moved to %s", path));
+ DBG(CXT, mnt_debug("current directory moved to %s", path2));

*filename = path;



--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 201210102344.17447.grossmms@googlemail.com">http://lists.debian.org/201210102344.17447.grossmms@googlemail.com
 

Thread Tools




All times are GMT. The time now is 10:19 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org