print errno also.
-/* $OpenBSD: doexec.c,v 1.5 2003/09/02 23:52:17 david Exp $ */
+/* $OpenBSD: doexec.c,v 1.6 2024/08/23 02:49:20 deraadt Exp $ */
/* $NetBSD: doexec.c,v 1.3 1995/04/20 22:43:13 cgd Exp $ */
/*
}
if (execve(argv[1], &argv[1], NULL) == -1) {
- printf("%s\n", strerror(errno));
+ printf("errno=%d\t%s\n", errno, strerror(errno));
exit(1);
}
-Exec format error
+errno=8 Exec format error
-Permission denied
+errno=13 Permission denied
-Exec format error
+errno=8 Exec format error
-succeeded
+errno=0 succeeded
-succeeded
+errno=0 succeeded
-No such file or directory
+errno=2 No such file or directory
-No such file or directory
+errno=2 No such file or directory
-+ echo succeeded
-succeeded
++ echo errno=0 succeeded
+errno=0 succeeded
-+ echo succeeded
-succeeded
++ echo errno=0 succeeded
+errno=0 succeeded
-Exec format error
+errno=8 Exec format error
-/* $OpenBSD: goodaout.c,v 1.5 2017/02/16 20:59:20 patrick Exp $ */
+/* $OpenBSD: goodaout.c,v 1.6 2024/08/23 02:49:20 deraadt Exp $ */
/* $NetBSD: goodaout.c,v 1.3 1995/04/20 22:44:20 cgd Exp $ */
/*
int
main(int argc, char *argv[])
{
- printf("succeeded\n");
+ printf("errno=0 succeeded\n");
exit(0);
}
#! /bin/csh
-# $OpenBSD: goodscript.in,v 1.2 2001/01/29 02:05:56 niklas Exp $
+# $OpenBSD: goodscript.in,v 1.3 2024/08/23 02:49:20 deraadt Exp $
-echo succeeded
+echo 'errno=0 succeeded'
#!/bin/sh -x
-# $OpenBSD: scriptarg-nospace.in,v 1.2 2001/01/29 02:05:56 niklas Exp $
+# $OpenBSD: scriptarg-nospace.in,v 1.3 2024/08/23 02:49:20 deraadt Exp $
-echo succeeded
+echo 'errno=0 succeeded'
#! /bin/sh -x
-# $OpenBSD: scriptarg.in,v 1.2 2001/01/29 02:05:57 niklas Exp $
+# $OpenBSD: scriptarg.in,v 1.3 2024/08/23 02:49:20 deraadt Exp $
-echo succeeded
+echo 'errno=0 succeeded'