Re: Help testing release candidate / mc-4.8.28-rc1
- From: Oswald Buddenhagen <oswald buddenhagen gmx de>
- To: mc-devel gnome org
- Subject: Re: Help testing release candidate / mc-4.8.28-rc1
- Date: Sun, 20 Mar 2022 19:12:13 +0100
On Sun, Mar 20, 2022 at 06:59:32PM +0300, Andrew Borodin wrote:
On Sun, 20 Mar 2022 15:22:14 +0100 Oswald Buddenhagen via mc-devel <mc-devel gnome org>
wrote:
`mc -P $file` doesn't work any more when the file already exists
(which is of course the case after file=`mktemp`).
Indeed.
A following patch is proposed:
diff --git a/src/main.c b/src/main.c
index 3a33dfb59..a4910349a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -492,6 +492,10 @@ main (int argc, char *argv[])
last_wd_fd = open (mc_args__last_wd_file, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
S_IRUSR | S_IWUSR);
+
+ if (last_wd_fd == -1 && errno == EEXIST)
+ last_wd_fd = open (mc_args__last_wd_file, O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR);
+
if (last_wd_fd != -1)
{
ssize_t ret1;
that seems overly complicated - why not just drop the O_EXCL? at least i
can't see an obvious reason for having it in the first place.
anyway, i wonder why i ran into this only recently, given that this
behavior is actually rather ancient. probably has something to do with
me porting the wrapper function from tempfile to mktemp (as debian
started to complain about deprecation), though the replacement itself
couldn't have caused it.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]