On Sun, 20 Mar 2022 15:22:14 +0100 Oswald Buddenhagen via mc-devel 
<mc-devel@gnome.org>
 wrote:
> On Sun, Mar 20, 2022 at 01:15:41PM +0100, Yury V. Zaytsev wrote:
> >TLDR; I would appreciate if you could please test the following tarball on 
> >your systems
> and report any blocker regressions as compared to the previous 4.8.27 release:
> >
> i tested master instead:
> 
> find.c: In function ‘find_cmd’:
> find.c:1837:28: warning: ‘start_dir_len’ may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   1837 |                 p = name + (size_t) start_dir_len;
>        |                            ^~~~~~~~~~~~~~~~~~~~~~
> find.c:1897:13: note: ‘start_dir_len’ was declared here
>   1897 |     ssize_t start_dir_len;
>        |             ^~~~~~~~~~~~~

This isn't critical. start_dir_len is an output of find_parameters().

> coord_cache.c: In function ‘mcview_ccache_add_entry’:
> coord_cache.c:97:5: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' 
> instead [-Wdeprecated-declarations]
>     97 |     cache->cache[pos] = g_memdup (entry, sizeof (*entry));
>        |     ^~~~~
> In file included from /usr/include/glib-2.0/glib.h:82,
>                   from ../../lib/global.h:66,
>                   from coord_cache.c:57:
> /usr/include/glib-2.0/glib/gstrfuncs.h:257:23: note: declared here
>    257 | gpointer              g_memdup         (gconstpointer mem,
>        |                       ^~~~~~~~

This is not critical too.
https://midnight-commander.org/ticket/4270#comment:12

> `mc -P $file` doesn't work any more when the file already exists (which is of 
> course the case after file=`mktemp`).

Indeed.
file is opened with O_CREAT | O_EXCL flags. In this case, as written in open(2),

O_EXCL Ensure  that  this call creates the file: if this flag is specified in 
conjunction
       with O_CREAT, and pathname already exists, then open() fails with the 
error EEXIST.

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;

-- 
Andrew
_______________________________________________
mc-devel mailing list
https://mail.gnome.org/mailman/listinfo/mc-devel

Reply via email to