summaryrefslogtreecommitdiff
path: root/libexec/ftpd
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2003-07-09 12:46:24 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2003-07-09 12:46:24 +0000
commit39bce482456d2b9402e277fc4b5251f288234aa5 (patch)
tree7dc5f4feaf7be013a6d171a8d4a63d3048fbd9cc /libexec/ftpd
parent45b2e6f2c954f4f47314bfbd396dafc8f8cc081c (diff)
Notes
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 69353dc6075b..31f9b2f6a1cd 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1494,9 +1494,11 @@ skip:
* c) expand it to the absolute pathname if necessary.
*/
if (dochroot && residue &&
- (chrootdir = strtok(residue, " \t")) != NULL &&
- chrootdir[0] != '/') {
- asprintf(&chrootdir, "%s/%s", pw->pw_dir, chrootdir);
+ (chrootdir = strtok(residue, " \t")) != NULL) {
+ if (chrootdir[0] != '/')
+ asprintf(&chrootdir, "%s/%s", pw->pw_dir, chrootdir);
+ else
+ chrootdir = strdup(chrootdir); /* so it can be freed */
if (chrootdir == NULL)
fatalerror("Ran out of memory.");
}