Module Name: src
Committed By: maya
Date: Mon Dec 25 05:08:49 UTC 2017
Modified Files:
src/usr.bin/ldd: ldd.1 ldd.c
Log Message:
Return a non-zero (one) exit code on failure for one of the files
But keep on processing them, like ls, rm, and other programs do
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/ldd/ldd.1
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/ldd/ldd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ldd/ldd.1
diff -u src/usr.bin/ldd/ldd.1:1.19 src/usr.bin/ldd/ldd.1:1.20
--- src/usr.bin/ldd/ldd.1:1.19 Mon Jul 3 21:34:19 2017
+++ src/usr.bin/ldd/ldd.1 Mon Dec 25 05:08:49 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: ldd.1,v 1.19 2017/07/03 21:34:19 wiz Exp $
+.\" $NetBSD: ldd.1,v 1.20 2017/12/25 05:08:49 maya Exp $
.\"
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd September 7, 2009
+.Dd December 25, 2017
.Dt LDD 1
.Os
.Sh NAME
@@ -105,6 +105,8 @@ which makes
.Nm
behave analogously to
.Ic nm Fl o .
+.Sh EXIT STATUS
+.Ex -std
.Sh SEE ALSO
.Xr ld 1 ,
.Xr ld.elf_so 1 ,
Index: src/usr.bin/ldd/ldd.c
diff -u src/usr.bin/ldd/ldd.c:1.22 src/usr.bin/ldd/ldd.c:1.23
--- src/usr.bin/ldd/ldd.c:1.22 Sun Mar 2 03:55:19 2014
+++ src/usr.bin/ldd/ldd.c Mon Dec 25 05:08:49 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.c,v 1.22 2014/03/02 03:55:19 matt Exp $ */
+/* $NetBSD: ldd.c,v 1.23 2017/12/25 05:08:49 maya Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ldd.c,v 1.22 2014/03/02 03:55:19 matt Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.23 2017/12/25 05:08:49 maya Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -122,7 +122,7 @@ int
main(int argc, char **argv)
{
const char *fmt1 = NULL, *fmt2 = NULL;
- int c;
+ int c, exit_status = EXIT_SUCCESS;
#ifdef DEBUG
debug = 1;
@@ -160,6 +160,7 @@ main(int argc, char **argv)
fd = open(*argv, O_RDONLY);
if (fd == -1) {
+ exit_status = EXIT_FAILURE;
warn("%s", *argv);
continue;
}
@@ -171,12 +172,14 @@ main(int argc, char **argv)
&& elf32_ldd_compat(fd, *argv, fmt1, fmt2) == -1
#endif
#endif
- )
+ ) {
+ exit_status = EXIT_FAILURE;
warnx("%s", error_message);
+ }
close(fd);
}
- return 0;
+ return exit_status;
}
/*