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
Internet Initiative Japan Inc.
NetBSD 6.0_STABLE NetBSD 6.0_STABLE (SEIL6) #0: Mon Jan 
 7 10:25:38 JST 2013 
__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)

build release set using tools and look for warning carefully.

# /usr/src
# ./ tools
# ./ release

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 @@
+#define __MKTEMP_OK__  /* All uses of mktemp have been checked */
 #include "nbtool_config.h"
@@ -50,7 +51,6 @@ __RCSID("$NetBSD: xinstall.c,v 1.115 2011/09/06 18:50:32 joerg
 Exp $");
 #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