enmasse: For the special case of 2 args, do not distinguish between dirs and files

This produces consistent error messages when moving or copying a file or dir to
itself.
This commit is contained in:
sin 2015-11-13 14:18:47 +00:00
parent 2f4ab52739
commit 996f992ac6

View File

@ -3,7 +3,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "../util.h" #include "../util.h"
@ -11,12 +10,11 @@
void void
enmasse(int argc, char *argv[], int (*fn)(const char *, const char *, int)) enmasse(int argc, char *argv[], int (*fn)(const char *, const char *, int))
{ {
struct stat st;
char buf[PATH_MAX], *dir; char buf[PATH_MAX], *dir;
int i, len; int i, len;
size_t dlen; size_t dlen;
if (argc == 2 && !(stat(argv[1], &st) == 0 && S_ISDIR(st.st_mode))) { if (argc == 2) {
fnck(argv[0], argv[1], fn, 0); fnck(argv[0], argv[1], fn, 0);
return; return;
} else { } else {