emacs-devel
[Top][All Lists]
Advanced

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

Re: unicode build: "comparison is always true" warnings


From: Mark A. Hershberger
Subject: Re: unicode build: "comparison is always true" warnings
Date: Fri, 23 Nov 2007 12:42:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> There is also a warning from movemail.c:
>>     warning: the use of `mktemp' is dangerous, better use `mkstemp' or
>>     `mkdtemp'
>
> This one looks bad.

I attempted to fix this.  It has been ages since I had to write C, but
this fix is almost identical to the one here: http://xrl.us/bbocw

I'll apply if this looks ok.

diff -u -b -r1.88 movemail.c
--- movemail.c  26 Jul 2007 05:26:12 -0000      1.88
+++ movemail.c  23 Nov 2007 17:38:40 -0000
@@ -325,14 +325,20 @@
        p--;
       *p = 0;
       strcpy (p, "EXXXXXX");
+#ifndef HAVE_MKSTEMP
       mktemp (tempname);
       unlink (tempname);
+#endif
 
       while (1)
        {
          /* Create the lock file, but not under the lock file name.  */
          /* Give up if cannot do that.  */
+#ifndef HAVE_MKSTEMP
          desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0666);
+#else
+          desc = mkstemp (tempname);
+#endif
          if (desc < 0)
            {
              char *message = (char *) xmalloc (strlen (tempname) + 50);




-- 
http://hexmode.com/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2  B37A 735E F10A 2DFC BFF5

The most beautiful experience we can have is the mysterious.
    -- Albert Einstein, The World As I See it





reply via email to

[Prev in Thread] Current Thread [Next in Thread]