bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] tempname: new try_tempname function


From: Paul Eggert
Subject: Re: [PATCH] tempname: new try_tempname function
Date: Mon, 02 Feb 2015 14:37:18 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 01/31/2015 02:49 PM, Andreas Gruenbacher wrote:
+static int
+try_file (char *tmpl, void *flags)
+{
+  return __open (tmpl,
+                (* (int *) flags & ~O_ACCMODE)
+                | O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+}

Please avoid the cast by changing the body to look like this:

   int *openflags = flags;
   return __open (tmpl, (*openflags & ~O_ACCMODE) | ...


+       /* Give up now. */

This comment no longer seems to make sense (the loop is now far away) and I'd remove it.

+      errno = EEXIST;

The code previously used __set_errno to set errno; shouldn't it still do that?


Other than that, it looks OK.



reply via email to

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