diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-07-29 20:46:41 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-07-29 20:46:41 +0000 |
commit | 1a151afc5e79c32513fc2e2935c2b0563d5be398 (patch) | |
tree | 25e0121c6aec5f0244a5c39a2bd9edc4329f4275 | |
parent | 70cfce4c3da80bd388c8407bfe1078009dc1fc82 (diff) |
Fixed a bug causing a CPU loop if dist'ing a file whose parent
dir doesn't exist on the target machine.
-rw-r--r-- | usr.bin/rdistd/filesys.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/rdistd/filesys.c b/usr.bin/rdistd/filesys.c index 34df4bf98ed..33b30ca6d07 100644 --- a/usr.bin/rdistd/filesys.c +++ b/usr.bin/rdistd/filesys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filesys.c,v 1.3 1996/06/26 05:38:21 deraadt Exp $ */ +/* $OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -35,7 +35,7 @@ #ifndef lint static char RCSid[] = -"$OpenBSD: filesys.c,v 1.3 1996/06/26 05:38:21 deraadt Exp $"; +"$OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $"; static char sccsid[] = "@(#)filesys.c"; @@ -119,9 +119,13 @@ char *find_file(pathname, statbuf, isvalid) * Normally we want to change /dir1/dir2/file * into "/dir1/dir2/." */ - if (p = (char *) strrchr(file, '/')) { - *++p = '.'; - *++p = CNULL; + if ((p = (char *) strrchr(file, '/'))) { + if (strcmp(p, "/.") == 0) { + *p = CNULL; + } else { + *++p = '.'; + *++p = CNULL; + } } else { /* * Couldn't find anything, so give up. |