summaryrefslogtreecommitdiff
path: root/coreutils/realpath.c
diff options
context:
space:
mode:
authorManuel Novoa III2003-03-19 09:13:01 +0000
committerManuel Novoa III2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/realpath.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
busybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
Major coreutils update.
Diffstat (limited to 'coreutils/realpath.c')
-rw-r--r--coreutils/realpath.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/coreutils/realpath.c b/coreutils/realpath.c
index f89e0a2..ec98221 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -14,17 +14,26 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
+
+/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
+ *
+ * Now does proper error checking on output and returns a failure exit code
+ * if one or more paths can not be resolved.
+ */
+
#include <limits.h>
#include <stdlib.h>
-
#include "busybox.h"
int realpath_main(int argc, char **argv)
{
+ int retval = EXIT_SUCCESS;
+
RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
if (--argc == 0) {
- show_usage();
+ bb_show_usage();
}
do {
@@ -32,11 +41,14 @@ int realpath_main(int argc, char **argv)
if (realpath(*argv, resolved_path) != NULL) {
puts(resolved_path);
} else {
- perror_msg("%s", *argv);
+ retval = EXIT_FAILURE;
+ bb_perror_msg("%s", *argv);
}
} while (--argc);
+#ifdef CONFIG_FEATURE_CLEAN_UP
RELEASE_CONFIG_BUFFER(resolved_path);
+#endif
- return(EXIT_SUCCESS);
+ bb_fflush_stdout_and_exit(retval);
}