Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   Bug#661527: Apparently a bug in libmount1 (http://www.linux-archive.org/debian-kernel/711327-bug-661527-apparently-bug-libmount1.html)

Matthias Gro▀mann 10-10-2012 09:44 PM

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


All times are GMT. The time now is 07:22 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.