[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 07/15: Normalize path of translators.
From: |
Samuel Thibault |
Subject: |
[hurd] 07/15: Normalize path of translators. |
Date: |
Sun, 19 Nov 2017 15:27:06 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch dde
in repository hurd.
commit 074f0ea9799b2fa5297eb120d68e0a97cf1b40ac
Author: Justus Winter <address@hidden>
Date: Sun Oct 9 00:13:46 2016 +0200
Normalize path of translators.
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Strip trailing
slashes.
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Likewise.
---
libdiskfs/dir-lookup.c | 8 +++++++-
libnetfs/dir-lookup.c | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 63bba78..a0c368b 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -286,6 +286,7 @@ diskfs_S_dir_lookup (struct protid *dircred,
{
char *translator_path = strdupa (relpath);
+ char *end;
char *complete_path;
if (nextname != NULL)
{
@@ -293,12 +294,17 @@ diskfs_S_dir_lookup (struct protid *dircred,
NEXTNAME points to the next component, locate
the end of the current component and use it
to trim TRANSLATOR_PATH. */
- char *end = nextname;
+ end = nextname;
while (*end != 0)
end--;
translator_path[end - filename_start] = '\0';
}
+ /* Trim trailing slashes. */
+ end = &translator_path[strlen (translator_path) - 1];
+ while (*end == '/' && end >= translator_path)
+ *end = '\0', end--;
+
if (dircred->po->path == NULL
|| !strcmp (dircred->po->path,"."))
/* dircred is the root directory. */
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 321ee6e..bfac2ac 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -277,6 +277,7 @@ netfs_S_dir_lookup (struct protid *dircred,
{
char *translator_path = strdupa (relpath);
+ char *end;
char *complete_path;
if (nextname != NULL)
{
@@ -284,12 +285,17 @@ netfs_S_dir_lookup (struct protid *dircred,
NEXTNAME points to the next component, locate
the end of the current component and use it
to trim TRANSLATOR_PATH. */
- char *end = nextname;
+ end = nextname;
while (*end != 0)
end--;
translator_path[end - filename_start] = '\0';
}
+ /* Trim trailing slashes. */
+ end = &translator_path[strlen (translator_path) - 1];
+ while (*end == '/' && end >= translator_path)
+ *end = '\0', end--;
+
if (dircred->po->path == NULL
|| !strcmp (dircred->po->path,"."))
/* dircred is the root directory. */
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch dde updated (4d4175c -> e3c726d), Samuel Thibault, 2017/11/19
- [hurd] 04/15: libfshelp: Avoid useless allocations., Samuel Thibault, 2017/11/19
- [hurd] 05/15: libfshelp: Always register dead-name notifications., Samuel Thibault, 2017/11/19
- [hurd] 07/15: Normalize path of translators.,
Samuel Thibault <=
- [hurd] 09/15: libfshelp: Avoid some right diddling., Samuel Thibault, 2017/11/19
- [hurd] 08/15: libfshelp: Improve error handling., Samuel Thibault, 2017/11/19
- [hurd] 12/15: libdiskfs: Shutdown pagers on startup_dosync., Samuel Thibault, 2017/11/19
- [hurd] 10/15: libfshelp: Use node instead of name as key., Samuel Thibault, 2017/11/19
- [hurd] 06/15: libfshelp: Add function to map over all active translators., Samuel Thibault, 2017/11/19
- [hurd] 02/15: libfshelp: improve translator list, Samuel Thibault, 2017/11/19
- [hurd] 01/15: pflocal: Use default stub implementations., Samuel Thibault, 2017/11/19
- [hurd] 15/15: Merge branch 'dde-upstream' into dde, Samuel Thibault, 2017/11/19
- [hurd] 03/15: Fix active translator registration., Samuel Thibault, 2017/11/19
- [hurd] 13/15: Merge remote-tracking branch 'mainline/master' into dde, Samuel Thibault, 2017/11/19