]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix regression in #864
authorArun Prakash Jana <engineerarun@gmail.com>
Thu, 4 Mar 2021 14:22:06 +0000 (19:52 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Thu, 4 Mar 2021 14:26:15 +0000 (19:56 +0530)
src/nnn.c

index 3f3526974094710dcce80645918d4b929d3b8031..a8e9a9fd34b2a7ce1c034e23aad13bf1d84fb0b2 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1330,16 +1330,17 @@ static size_t seltofile(int fd, uint_t *pcount)
        return pos;
 }
 
-/* List selection from selection file (another instance) */
-static bool listselfile(void)
+static bool isselfileempty(void)
 {
        struct stat sb;
 
-       if (stat(selpath, &sb) == -1)
-               return FALSE;
+       return (stat(selpath, &sb) == -1) || (!sb.st_size);
+}
 
-       /* Nothing selected if file size is 0 */
-       if (!sb.st_size)
+/* List selection from selection file (another instance) */
+static bool listselfile(void)
+{
+       if (isselfileempty())
                return FALSE;
 
        snprintf(g_buf, CMD_LEN_MAX, "tr \'\\0\' \'\\n\' < %s", selpath);
@@ -2087,6 +2088,11 @@ static bool cpmvrm_selection(enum action sel, char *path)
 {
        int r;
 
+       if (isselfileempty()) {
+               printmsg(messages[MSG_0_SELECTED]);
+               return FALSE;
+       }
+
        if (!selsafe())
                return FALSE;