Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/tftpd If opening files for writing, be sure to trunc...



details:   https://anonhg.NetBSD.org/src/rev/3feced57dbcc
branches:  trunk
changeset: 473959:3feced57dbcc
user:      carrel <carrel%NetBSD.org@localhost>
date:      Wed Jun 23 15:41:48 1999 +0000

description:
If opening files for writing, be sure to truncate.

diffstat:

 libexec/tftpd/tftpd.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 02a434dd405d -r 3feced57dbcc libexec/tftpd/tftpd.c
--- a/libexec/tftpd/tftpd.c     Wed Jun 23 15:20:36 1999 +0000
+++ b/libexec/tftpd/tftpd.c     Wed Jun 23 15:41:48 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tftpd.c,v 1.16 1999/02/07 21:38:44 aidan Exp $ */
+/*     $NetBSD: tftpd.c,v 1.17 1999/06/23 15:41:48 carrel Exp $        */
 
 /*
  * Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)tftpd.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tftpd.c,v 1.16 1999/02/07 21:38:44 aidan Exp $");
+__RCSID("$NetBSD: tftpd.c,v 1.17 1999/06/23 15:41:48 carrel Exp $");
 #endif
 #endif /* not lint */
 
@@ -549,7 +549,7 @@
                        *filep = filename;
                }
        }
-       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");



Home | Main Index | Thread Index | Old Index