[Toybox] [PATCH] mktemp: fix warning with glibc 2.15.

enh enh at google.com
Mon Dec 3 09:56:25 PST 2018


Old versions of glibc had warn_unused_result on mktemp(3), despite it
always returning its argument. Still, we can silence the warning and
save a line, so...
---
 toys/lsb/mktemp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c
index 440cf6b1..ae97e494 100644
--- a/toys/lsb/mktemp.c
+++ b/toys/lsb/mktemp.c
@@ -48,8 +48,7 @@ void mktemp_main(void)
       ? xstrdup(template) : xmprintf("%s/%s", TT.p, template);

   if (toys.optflags & FLAG_u) {
-    mktemp(template);
-    xputs(template);
+    xputs(mktemp(template));
   } else if (toys.optflags & FLAG_d ? !mkdtemp(template) :
mkstemp(template) == -1) {
     if (toys.optflags & FLAG_q) toys.exitval = 1;
     else perror_exit("Failed to create %s %s/%s",
-- 
2.19.1.930.g4563a0d9d0-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mktemp-fix-warning-with-glibc-2.15.patch
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181203/db1aba8c/attachment-0002.bin>


More information about the Toybox mailing list