[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, master, updated. c2db2b9ff8465cb5044e6f2
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, master, updated. c2db2b9ff8465cb5044e6f22beb229336479be57 |
Date: |
Tue, 11 Sep 2012 19:16:53 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, master has been updated
via c2db2b9ff8465cb5044e6f22beb229336479be57 (commit)
from 47f2bd34643ceda78773e5abbfa466c2f898a815 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c2db2b9ff8465cb5044e6f22beb229336479be57
commit c2db2b9ff8465cb5044e6f22beb229336479be57
Author: Arnold D. Robbins <address@hidden>
Date: Tue Sep 11 22:16:38 2012 +0300
Make readdir set ERRNO more.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index fcc9d8a..e37715a 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-11 Arnold D. Robbins <address@hidden>
+
+ * readdir.c (do_readdir_do_ftype): Set ERRNO for bad arguments.
+ * readdir.3a: Document same, minor fixes.
+
2012-09-07 Akim Demaille <address@hidden>
* extension/gawkfts.h (__THROW): Define if it is not.
diff --git a/extension/readdir.3am b/extension/readdir.3am
index 4479c61..5e03f49 100644
--- a/extension/readdir.3am
+++ b/extension/readdir.3am
@@ -1,4 +1,4 @@
-.TH READDIR 3am "Aug 31 2012" "Free Software Foundation" "GNU Awk Extension
Modules"
+.TH READDIR 3am "Sep 11 2012" "Free Software Foundation" "GNU Awk Extension
Modules"
.SH NAME
readdir \- directory input parser for gawk
.SH SYNOPSIS
@@ -45,9 +45,9 @@ for a socket, and
On systems without the file type information, calling
.B readdir_do_ftype("stat")
causes the extension to use
-.IR stat (2)
+.IR lstat (2)
to retrieve the appropriate information. This is not the default, since
-.IR stat (2)
+.IR lstat (2)
is a potentially expensive operation. By calling
.B readdir_do_ftype("never")
one can ensure that the file type
@@ -55,9 +55,15 @@ information is never displayed, even when readily available
in the
directory entry.
.PP
The third option,
-.B readdir_do_ftype("dirent") ,
+.BR readdir_do_ftype("dirent") ,
takes file type information from the directory entry, if it is available.
This is the default on systems that supply this information.
+.PP
+The
+.B readdir_do_ftype()
+function will set
+.B ERRNO
+if called without arguments or with invalid arguments.
.SH NOTES
On GNU/Linux systems, there are filesystems that don't support the
.B d_type
@@ -70,7 +76,7 @@ Therefore, using
is advisable even on GNU/Linux systems. In this case, the
.I readdir
extension will fall back to using
-.IR stat (2)
+.IR lstat (2)
when it encounters an unknown file type.
... .SH BUGS
.SH EXAMPLE
diff --git a/extension/readdir.c b/extension/readdir.c
index 49a6bf6..7140b72 100644
--- a/extension/readdir.c
+++ b/extension/readdir.c
@@ -111,6 +111,7 @@ ftype(struct dirent *entry)
*/
return NULL;
+ /* Should we set ERRNO here? */
if (lstat(entry->d_name, & sbuf) < 0)
return "u";
@@ -299,6 +300,7 @@ do_readdir_do_ftype(int nargs, awk_value_t *result)
make_number(1.0, result);
if (nargs < 1) {
warning(ext_id, _("readdir_do_ftype: called with no
arguments"));
+ update_ERRNO_int(EINVAL);
make_number(0.0, result);
goto out;
} else if (do_lint && nargs > 3)
@@ -306,6 +308,7 @@ do_readdir_do_ftype(int nargs, awk_value_t *result)
if (! get_argument(0, AWK_STRING, & flag)) {
warning(ext_id, _("readdir_do_ftype: could not get argument"));
+ update_ERRNO_int(EINVAL);
make_number(0.0, result);
goto out;
}
@@ -316,8 +319,10 @@ do_readdir_do_ftype(int nargs, awk_value_t *result)
do_ftype = USE_DIRENT_INFO;
else if (strcmp(flag.str_value.str, "stat") == 0)
do_ftype = USE_STAT_INFO;
- else
+ else {
+ update_ERRNO_int(EINVAL);
make_number(0.0, result);
+ }
out:
return result;
-----------------------------------------------------------------------
Summary of changes:
extension/ChangeLog | 5 +++++
extension/readdir.3am | 16 +++++++++++-----
extension/readdir.c | 7 ++++++-
3 files changed, 22 insertions(+), 6 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, master, updated. c2db2b9ff8465cb5044e6f22beb229336479be57,
Arnold Robbins <=