aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nnn.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/nnn.c b/nnn.c
index 5397be1..02b2bd6 100644
--- a/nnn.c
+++ b/nnn.c
@@ -1013,10 +1013,9 @@ xreadline(char *fname)
size_t buflen = NAME_MAX - 1;
DPRINTF_S(fname)
- mbstowcs(buf, fname, NAME_MAX);
- len = pos = wcslen(buf);
+ len = pos = mbstowcs(buf, fname, NAME_MAX);
/* For future: handle NULL, say for a new name */
- if (len <= 0) {
+ if (len == (size_t)-1) {
buf[0] = '\0';
len = pos = 0;
}