1 From c7d25bb9c54af16d70f98bff1bc55de314023d7a Mon Sep 17 00:00:00 2001
2 From: Pat Thoyts <patthoyts@users.sourceforge.net>
3 Date: Wed, 15 May 2013 13:25:52 +0100
4 Subject: [PATCH] ccache: handle both forward and backward slashes as path
7 I was using a mingw ccache from these sources, when it started complaining
8 about not being able to unlink files from the Administrator home directory.
10 So what should have been happening was deleting stuff from
12 C:\Dokumente und Einstellungen\Administrator\.ccache
14 What happened is that the program interpreted
16 dirname("C:\Dokumente und Einstellungen\Administrator/.ccache")
18 as "C:\Dokumente und Einstellungen" due to the dirname code not properly
19 seeing "/" as seperator. So this can be fixed by rewriting dirname() as in
20 the patch I'll attach.
22 [ccache-win32 issue #7]
24 Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
26 util.c | 11 ++++++-----
27 1 file changed, 6 insertions(+), 5 deletions(-)
29 diff --git a/util.c b/util.c
30 index 531883d..c129914 100644
33 @@ -285,12 +285,13 @@ char *str_basename(const char *s)
34 /* return the dir name of a file - caller frees */
35 char *dirname(char *s)
40 - p = strrchr(s, '/');
41 - p = strrchr(s, '\\');
44 + for (p = s; *p; p++)
45 + if (*p == '/' || *p == '\\')