summaryrefslogtreecommitdiffstats
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-11-30 20:59:32 +0000
committerjoerg <joerg@FreeBSD.org>1996-11-30 20:59:32 +0000
commit697c32345ed353ef71779fcebe2ad32f2747a771 (patch)
treefc54f2a14ee3b6bf38ff85a335800c894f9839c8 /libexec/tftpd
parent0cd4dcf745ee2cd8bf47611e99154dbbc18c6018 (diff)
downloadFreeBSD-src-697c32345ed353ef71779fcebe2ad32f2747a771.zip
FreeBSD-src-697c32345ed353ef71779fcebe2ad32f2747a771.tar.gz
Truncate the file when opening it with write intent. Otherwise,
there's a good chance that garbage will remain at the end. Closes PR # bin/2112: tftpd doesn't truncate ... Reviewed by: fenner
Diffstat (limited to 'libexec/tftpd')
-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 d46676e..b668f2e 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: tftpd.c,v 1.4 1996/09/22 21:56:07 wosch Exp $
*/
#ifndef lint
@@ -435,7 +435,7 @@ validate_access(filep, mode)
return (err);
*filep = filename = pathname;
}
- 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");
OpenPOWER on IntegriCloud