[BusyBox-cvs] busybox/shellutils realpath.c,1.1,1.2
Glenn McGrath
bug1 at busybox.net
Tue Dec 10 03:16:40 UTC 2002
- Previous message: [BusyBox-cvs] busybox/archival rpm.c,1.1,1.2
- Next message: [BusyBox-cvs] busybox/debian busybox-cvs-static.manpages,NONE,1.1 busybox-cvs.manpages,NONE,1.1 changelog,1.29,1.30 config-udeb,1.5,1.6 control,1.14,1.15 rules,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/busybox/shellutils
In directory winder:/tmp/cvs-serv22532/shellutils
Modified Files:
realpath.c
Log Message:
Fix undefined behaviour and save some bytes as suggested by Manuel Novoa III
Index: realpath.c
===================================================================
RCS file: /var/cvs/busybox/shellutils/realpath.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- realpath.c 10 Dec 2002 00:14:33 -0000 1.1
+++ realpath.c 10 Dec 2002 03:16:37 -0000 1.2
@@ -21,24 +21,22 @@
int realpath_main(int argc, char **argv)
{
- char *resolved_path;
- int count;
+ RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX);
- if (argc == 1) {
+ if (--argc == 0) {
show_usage();
}
- resolved_path = malloc(PATH_MAX);
-
- for (count = 1; count < argc; count++) {
- resolved_path = realpath(argv[count], resolved_path);
- if (resolved_path) {
+ do {
+ argv++;
+ if (realpath(*argv, resolved_path) != NULL) {
puts(resolved_path);
} else {
- perror_msg("%s", argv[count]);
+ perror_msg("%s", *argv);
}
- }
- free(resolved_path);
+ } while (--argc);
+
+ RELEASE_CONFIG_BUFFER(resolved_path);
return(EXIT_SUCCESS);
-}
\ No newline at end of file
+}
- Previous message: [BusyBox-cvs] busybox/archival rpm.c,1.1,1.2
- Next message: [BusyBox-cvs] busybox/debian busybox-cvs-static.manpages,NONE,1.1 busybox-cvs.manpages,NONE,1.1 changelog,1.29,1.30 config-udeb,1.5,1.6 control,1.14,1.15 rules,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the busybox-cvs
mailing list