zsh-workers
 help / color / mirror / code / Atom feed
From: "John T. Guthrie" <guthrie@counterexample.org>
To: zsh-workers@sunsite.dk
Cc: guthrie@counterexample.org
Subject: PATCH: small compilation cleanup for utils.c
Date: Tue, 18 Feb 2003 03:46:35 -0500	[thread overview]
Message-ID: <200302180846.h1I8kZc12536@gauss.counterexample.org> (raw)

Hello all,

This is a very small patch to clean up compilation on RedHat Linux.  (And,
I believe on most anything that uses GLIBC >= 2.0, but I'm not certain of
that.)  When compiling on RedHat Linux 8.0, I get the compilation complaint:

utils.o: In function `gettempname':
utils.o(.text+0x1b1a): the use of `mktemp' is dangerous, better use `mkstemp'

This patch fixes that for systems that have mktemp(), but not _mktemp().  I
saw that configure was testing for both mkstemp() and _mktemp(), but the code
only used _mktemp().  I don't know whether the test for HAVE_MKSTEMP should
come before or after the test for HAVE__MKTEMP, so let me know if there is a
different preferred order.

John Guthrie
guthrie@counterexample.org

--------------------------BEGIN PATCH--------------------------------

*** utils.c.orig        2002-10-15 14:00:00.000000000 -0400
--- utils.c     2003-02-18 02:51:59.000000000 -0500
***************
*** 1108,1119 ****
--- 1108,1123 ----
      if (!(s = getsparam("TMPPREFIX")))
        s = DEFAULT_TMPPREFIX;
   
+ #ifdef HAVE_MKSTEMP
+     ret = ((char *) mkstemp(dyncat(unmeta(s), "XXXXXX")));
+ #else
  #ifdef HAVE__MKTEMP
      /* Zsh uses mktemp() safely, so silence the warnings */
      ret = ((char *) _mktemp(dyncat(unmeta(s), "XXXXXX")));
  #else
      ret = ((char *) mktemp(dyncat(unmeta(s), "XXXXXX")));
  #endif
+ #endif
      unqueue_signals();
  
      return ret;


             reply	other threads:[~2003-02-18  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-18  8:46 John T. Guthrie [this message]
2003-02-18  9:13 ` Zefram
2003-02-19  5:38   ` John T. Guthrie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302180846.h1I8kZc12536@gauss.counterexample.org \
    --to=guthrie@counterexample.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).