summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authortsi <tsi>2007-09-16 01:42:17 +0000
committertsi <tsi>2007-09-16 01:42:17 +0000
commit4c1fdcffd401ccd68a51bee568273712489c9884 (patch)
treecb37cff9d2bf3b1cd3bd46eecbef2729ba3d14cc /config
parent0b61460a62f750ff555930995b748cfbd267a88e (diff)
3. Change `lndir` utility to trim off trailing self-references (i.e. "/" and
"/." from its "from" argument (Marc La France).
Diffstat (limited to 'config')
-rw-r--r--config/util/lndir.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/config/util/lndir.c b/config/util/lndir.c
index ec2131173..008c32867 100644
--- a/config/util/lndir.c
+++ b/config/util/lndir.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/config/util/lndir.c,v 3.25tsi Exp $ */
+/* $XFree86: xc/config/util/lndir.c,v 3.26tsi Exp $ */
/* Create shadow link tree (after X11R4 script of the same name)
Mark Reinhold (mbr@lcs.mit.edu)/3 January 1990 */
@@ -525,7 +525,7 @@ main (int ac, char *av[])
char *prog_name = av[0];
char *fn = NULL, *tn;
struct stat fs, ts;
- int ret = 0;
+ int ret = 0, len;
while (++av, --ac) {
if ((strcmp(*av, "-silent") == 0) ||
@@ -592,8 +592,8 @@ main (int ac, char *av[])
if (clean_only) {
if (cleandir(tn) == -1)
- exit(1);
- exit(0);
+ return 1;
+ return 0;
}
/* from directory */
@@ -606,11 +606,18 @@ main (int ac, char *av[])
#endif
quit (2, "%s: Not a directory", fn);
+ /* Strip off from directory's trailing self references */
+ len = strlen(fn);
+ while ((--len > 1) &&
+ ((fn[len] == '/') ||
+ ((fn[len] == '.') && (fn[len - 1] == '/'))))
+ fn[len] = '\0';
+
ret = dodir (fn, &fs, &ts, 0);
if (ret == 0 && clean)
if (cleandir(tn) < 0)
ret = 1;
- exit(ret);
+ return ret;
}