diff options
author | des <des@FreeBSD.org> | 2003-11-04 22:39:25 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-11-04 22:39:25 +0000 |
commit | 81a5a11af4b3b415bc48af403d2bf94e75241a76 (patch) | |
tree | 60dcb6f082b33d1ff41676cc5a5f05d5260e0f51 /usr.bin/sed | |
parent | 2f6cf5f97e8c2707a18932d66f4ab2bbc925d16a (diff) | |
download | FreeBSD-src-81a5a11af4b3b415bc48af403d2bf94e75241a76.zip FreeBSD-src-81a5a11af4b3b415bc48af403d2bf94e75241a76.tar.gz |
Fix the case where the file is not in the current directory.
Discovered by: Vladimir Kravchenko <jimson@mostcom.ru>
Pointy hat to: des
Diffstat (limited to 'usr.bin/sed')
-rw-r--r-- | usr.bin/sed/main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 216cd42..77c89ae 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -363,7 +363,8 @@ mf_fgets(SPACE *sp, enum e_spflag spflag) errx(1, "%s: name too long", fname); } len = snprintf(tmpfname, sizeof(tmpfname), - ".!%ld!%s", (long)getpid(), fname); + "%s/.!%ld!%s", dirname(fname), (long)getpid(), + basename(fname)); if (len >= sizeof(tmpfname)) errx(1, "%s: name too long", fname); unlink(tmpfname); |