2015-02-03 17:19 GMT+01:00 Paul Eggert :
> Thanks, that looks good; please install.
Done, thanks.
Andreas
On 02/03/2015 12:23 AM, Andreas Gruenbacher wrote:
Here's one (hopefully last) update.
Thanks, that looks good; please install.
From: Andreas Gruenbacher
2015-02-03 2:11 GMT+01:00 Paul Eggert :
> Thanks, one further suggestion. The above can be simplified to:
>
> if (__lxstat64 (_STAT_VER, tmpl, &st) == 0)
> __set_errno (EEXIST);
> return errno == ENOENT ? 0 : -1;
Here's one (hopefully last) update.
Andreas
--
Andreas Grünbacher wrote:
+ if (__lxstat64 (_STAT_VER, tmpl, &st) < 0)
+{
+ if (errno == ENOENT)
+ return 0;
+}
+ else
+__set_errno (EEXIST);
+ return -1;
Thanks, one further suggestion. The above can be simplified to:
if (__lxstat64 (_STAT_VER, tmpl, &st) == 0)
ghtly.
New version attached.
Thanks,
Andreas
From 8abda1c9752d07c9450057acd1aa9ec3220f9a28 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher
Date: Sat, 31 Jan 2015 23:49:13 +0100
Subject: [PATCH] tempname: new try_tempname function
The way how gen_tempname() creates files is not always sufficien
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 l
Paul and all,
is this change okay? I need this so that I can get patch to behave
consistently across platforms on failures.
Thanks,
Andreas
The way how gen_tempname() creates files is not always sufficient. For example,
it may make sense to create directories when creating the temporary file or
directory fails with errno set to ENOENT. Add a try_tempname() variant of
gen-tempname() that allows to do all that, and implement gen_tempnam
Andreas Grünbacher wrote:
Well, try_file() passes the flags on to open() for gen_tempfile's
GT_FILE mode.
Ah, sorry, I missed that.
For some uses (like mine), a create mode parameter wouldn't hurt, either.
Then I suggest just passing a generic (void const *) argument to the TRY
function.
2015-01-31 23:20 GMT+01:00 Paul Eggert :
> Thanks for this improvement. However, I don't see why the new
> __gen_tempname needs a FLAGS argument, as the new little functions now take
> care of the flags.
Well, try_file() passes the flags on to open() for gen_tempfile's
GT_FILE mode. I don't think
Thanks for this improvement. However, I don't see why the new __gen_tempname
needs a FLAGS argument, as the new little functions now take care of the flags.
The way how gen_tempname() creates files is not always sufficient. For example,
it may make sense to create directories when creating the temporary file or
directory fails with errno set to ENOENT. Add a try_tempname() variant of
gen-tempname() that allows to do all that and implement gen_tempname
12 matches
Mail list logo