summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-03 00:25:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-03 00:25:53 +0000
commit89fdc270089769539c1cf0f544723f8853f341b1 (patch)
tree6b157595a05deba054763017d5121395a13a51ff
parent306b1093e90fc5c427f708f9bc966cebb9751f42 (diff)
O_TRUNC when needed; freebsd pr#2112
-rw-r--r--libexec/tftpd/tftpd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 3e199bcbe65..c95fd652123 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)tftpd.c 5.13 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: tftpd.c,v 1.3 1996/08/12 08:29:45 deraadt Exp $";
+static char rcsid[] = "$Id: tftpd.c,v 1.4 1996/12/03 00:25:52 deraadt Exp $";
#endif /* not lint */
/*
@@ -349,7 +349,7 @@ validate_access(filename, mode)
if ((stbuf.st_mode&(S_IWRITE >> 6)) == 0)
return (EACCESS);
}
- fd = open(filename, mode == RRQ ? 0 : 1);
+ fd = open(filename, mode == RRQ ? O_RDONLY : (O_WRONLY|O_TRUNC));
if (fd < 0)
return (errno + 100);
file = fdopen(fd, (mode == RRQ)? "r":"w");