Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10367/ntfsprogs
Modified Files:
ntfsmount.c
Log Message:
libntfs/volume.c: fix ntfs_check_if_mounted to cope with dirrerent names of same file.
ntfsprogs/ntfsmount.c: don't put relative path to /etc/mtab.
Index: ntfsmount.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsmount.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- ntfsmount.c 15 Jul 2005 15:53:29 -0000 1.11
+++ ntfsmount.c 18 Jul 2005 02:09:43 -0000 1.12
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <locale.h>
#include <signal.h>
+#include <limits.h>
#ifdef HAVE_SETXATTR
#include <sys/xattr.h>
@@ -905,12 +906,12 @@ static char *parse_options(char *options
*device = NULL;
/*
- * +3 for different in length of "fsname=..." and "dev=...".
- * +1 for comma
- * +1 for null-terminator.
- * Total: +5
+ * +3 for different in length of "fsname=..." and "dev=...".
+ * +1 for comma.
+ * +1 for null-terminator.
+ * +PATH_MAX for resolved by realpath() device name
*/
- ret = malloc(strlen(def_opts) + strlen(options) + 5);
+ ret = malloc(strlen(def_opts) + strlen(options) + 5 + PATH_MAX);
if (!ret) {
perror("malloc failed");
return NULL;
@@ -929,8 +930,19 @@ static char *parse_options(char *options
Eprintf("dev option should have value.\n");
goto err_exit;
}
- *device = malloc(strlen(val) + 1);
- strcpy(*device, val);
+ *device = malloc(PATH_MAX + 1);
+ if (!*device)
+ goto err_exit;
+ /* We don't want relative path in /etc/mtab. */
+ if (val[0] != '/') {
+ if (!realpath(val, *device)) {
+ perror("");
+ free(*device);
+ *device = NULL;
+ goto err_exit;
+ }
+ } else
+ strcpy(*device, val);
} else if (!strcmp(opt, "ro")) { /* Read-only mount. */
if (val) {
Eprintf("ro option should not have value.\n");
|