about summary refs log tree commit diff
path: root/lr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lr.c')
-rw-r--r--lr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lr.c b/lr.c
index c95f1b8..29463a4 100644
--- a/lr.c
+++ b/lr.c
@@ -1434,7 +1434,9 @@ print_shquoted(const char *s)
 void
 print_noprefix(struct fileinfo *fi)
 {
-	if (strlen(fi->fpath) > fi->prefixl + 1)  /* strip prefix */
+	if (fi->prefixl == 0)
+		print_shquoted(fi->fpath);
+	else if (strlen(fi->fpath) > fi->prefixl + 1)  /* strip prefix */
 		print_shquoted(fi->fpath + fi->prefixl + 1);
 	else if (S_ISDIR(fi->sb.st_mode))  /* turn empty string into "." */
 		printf(".");
@@ -1834,6 +1836,8 @@ traverse_file(FILE *file)
 	struct stat st;
 	ssize_t rd;
 
+	prefixl = 0;
+
 	while (1) {
 		errno = 0;
 		rd = getdelim(&line, &linelen, input_delim, file);