Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: $(<nofile) doesn't set $? to non-zero



2018-03-15 09:23:05 +0000, Peter Stephenson:
[...]
> That should be more consistent, thanks.  I've committed it (minor
> tweaks).
[...]

Sorry, my bad, I've left an unused variable in the patch.

diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index 771e5b5fc..7a903418f 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -197,9 +197,8 @@ get_contents(char *fname)
     val = NULL;
     if ((fd = open(fname, O_RDONLY | O_NOCTTY)) >= 0) {
 	LinkList ll;
-	int readerror;
 
-	if ((ll = readoutput(fd, 1, &readerror)))
+	if ((ll = readoutput(fd, 1, 0)))
 	    val = peekfirst(ll);
     }
 #endif /* USE_MMAP */


I initially  thought it would be nice to report errors when the
file cannot be read in $mapfile[file], but then gave up on it on
the ground that it was not done with mmap().

Now maybe it would make sense to report errors other than ENOENT
here (even for the open)?

But then that could become annoying for things like
(($+mapfile[somefile])) (not that people should use that).

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author