aboutsummaryrefslogtreecommitdiff
path: root/coreutils/realpath.c
diff options
context:
space:
mode:
authormjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
committermjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-19 09:13:01 +0000
commite901c15d890dbbdce4c086963cb1513653fc46b5 (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/realpath.c
parent40758c00616c3b2c85d83eb4afdeb04b1f65c9f1 (diff)
downloadbusybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.gz
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.bz2
busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.zip
Major coreutils update.
git-svn-id: svn://busybox.net/trunk/busybox@6751 69ca8d6d-28ef-0310-b511-8ec308f3f277
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 f89e0a274..ec98221ad 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -14,17 +14,26 @@
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */ 15 */
16 16
17/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
18
19/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
20 *
21 * Now does proper error checking on output and returns a failure exit code
22 * if one or more paths can not be resolved.
23 */
24
17#include <limits.h> 25#include <limits.h>
18#include <stdlib.h> 26#include <stdlib.h>
19
20#include "busybox.h" 27#include "busybox.h"
21 28
22int realpath_main(int argc, char **argv) 29int realpath_main(int argc, char **argv)
23{ 30{
31 int retval = EXIT_SUCCESS;
32
24 RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX); 33 RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
25 34
26 if (--argc == 0) { 35 if (--argc == 0) {
27 show_usage(); 36 bb_show_usage();
28 } 37 }
29 38
30 do { 39 do {
@@ -32,11 +41,14 @@ int realpath_main(int argc, char **argv)
32 if (realpath(*argv, resolved_path) != NULL) { 41 if (realpath(*argv, resolved_path) != NULL) {
33 puts(resolved_path); 42 puts(resolved_path);
34 } else { 43 } else {
35 perror_msg("%s", *argv); 44 retval = EXIT_FAILURE;
45 bb_perror_msg("%s", *argv);
36 } 46 }
37 } while (--argc); 47 } while (--argc);
38 48
49#ifdef CONFIG_FEATURE_CLEAN_UP
39 RELEASE_CONFIG_BUFFER(resolved_path); 50 RELEASE_CONFIG_BUFFER(resolved_path);
51#endif
40 52
41 return(EXIT_SUCCESS); 53 bb_fflush_stdout_and_exit(retval);
42} 54}