NetBSD-Bugs archive

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

bin/48195: wrong position of __MKTEMP_OK__ in src/usr.bin/xinstall.c



>Number:         48195
>Category:       bin
>Synopsis:       wrong position of __MKTEMP_OK__ in src/usr.bin/xinstall.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 09 03:30:00 +0000 2013
>Originator:     SUENAGA Hiroki
>Release:        6.0_STABLE
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD sue-seil6.tokyo.iiji.jp 6.0_STABLE NetBSD 6.0_STABLE (SEIL6) #0: Mon Jan 
 7 10:25:38 JST 2013  
hsuenaga%sue-seil6.tokyo.iiji.jp@localhost:/usr/src/sys/arch/i386/compile/SEIL6 
i386
>Description:
__MKTEMP_OK__ should be defined before include "nbtool_config.h." otherwise 
tools-compiler print warning message of "mktemp() possibly used unsafely, use 
mkstemp() or mkdtemp()." for the reason that nbtool_config.h declares mktemp() 
in stdlib.h. (at least x86)

src/usr.bin/xinstall/xinstall.c:33 #include "nbtool_config.h"
src/tools/compat/obj/nbtool_config.h:643 #incldue "compat_defs.h" (generated)
src/tools/compat/compat_defs.h:45 #include <stdlib.h> (__MKTEMP_OK__ is not 
defined here)

>How-To-Repeat:
build release set using tools and look for warning carefully.

# /usr/src
# ./build.sh tools
# ./build.sh release

>Fix:
attached patch can suppress the warning.
I don't know about tools/compat should be modified or not.

diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 2dfcc0a..896136b 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -29,6 +29,7 @@
  * SUCH DAMAGE.
  */
 
+#define __MKTEMP_OK__  /* All uses of mktemp have been checked */
 #if HAVE_NBTOOL_CONFIG_H
 #include "nbtool_config.h"
 #else
@@ -50,7 +51,6 @@ __RCSID("$NetBSD: xinstall.c,v 1.115 2011/09/06 18:50:32 joerg
 Exp $");
 #endif
 #endif /* not lint */
 
-#define __MKTEMP_OK__  /* All uses of mktemp have been checked */
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <sys/stat.h>



Home | Main Index | Thread Index | Old Index