svn commit: branches/uClibc-nptl/utils

carmelo at uclibc.org carmelo at uclibc.org
Thu Nov 27 14:43:17 UTC 2008


Author: carmelo
Date: 2008-11-27 06:43:17 -0800 (Thu, 27 Nov 2008)
New Revision: 24164

Log:
Synch with trunk @ 24160
Step 16: utils folder synch.


Modified:
   branches/uClibc-nptl/utils/chroot_realpath.c
   branches/uClibc-nptl/utils/ldd.c


Changeset:
Modified: branches/uClibc-nptl/utils/chroot_realpath.c
===================================================================
--- branches/uClibc-nptl/utils/chroot_realpath.c	2008-11-27 14:41:51 UTC (rev 24163)
+++ branches/uClibc-nptl/utils/chroot_realpath.c	2008-11-27 14:43:17 UTC (rev 24164)
@@ -1,5 +1,5 @@
 /*
- * chroot_realpath.c -- reslove pathname as if inside chroot
+ * chroot_realpath.c -- resolve pathname as if inside chroot
  * Based on realpath.c Copyright (C) 1993 Rick Sladkey <jrs at world.std.com>
  *
  * This program is free software; you can redistribute it and/or
@@ -32,10 +32,6 @@
 #include <limits.h>		/* for PATH_MAX */
 #include <sys/param.h>		/* for MAXPATHLEN */
 #include <errno.h>
-#ifndef __set_errno
-#define __set_errno(val) ((errno) = (val))
-#endif
-
 #include <sys/stat.h>		/* for S_IFLNK */
 
 #ifndef PATH_MAX
@@ -67,7 +63,7 @@
 	chroot_len = strlen(chroot);
 
 	if (chroot_len + strlen(path) >= PATH_MAX - 3) {
-		__set_errno(ENAMETOOLONG);
+		errno = ENAMETOOLONG;
 		return NULL;
 	}
 
@@ -112,7 +108,7 @@
 		/* Safely copy the next pathname component. */
 		while (*path != '\0' && *path != '/') {
 			if (path > max_path) {
-				__set_errno(ENAMETOOLONG);
+				errno = ENAMETOOLONG;
 				return NULL;
 			}
 			*new_path++ = *path++;
@@ -123,7 +119,7 @@
 #ifdef S_IFLNK
 		/* Protect against infinite loops. */
 		if (readlinks++ > MAX_READLINKS) {
-			__set_errno(ELOOP);
+			errno = ELOOP;
 			return NULL;
 		}
 		/* See if latest pathname component is a symlink. */
@@ -148,7 +144,7 @@
 				while (*(--new_path) != '/') ;
 			/* Safe sex check. */
 			if (strlen(path) + n >= PATH_MAX - 2) {
-				__set_errno(ENAMETOOLONG);
+				errno = ENAMETOOLONG;
 				return NULL;
 			}
 			/* Insert symlink contents into path. */

Modified: branches/uClibc-nptl/utils/ldd.c
===================================================================
--- branches/uClibc-nptl/utils/ldd.c	2008-11-27 14:41:51 UTC (rev 24163)
+++ branches/uClibc-nptl/utils/ldd.c	2008-11-27 14:43:17 UTC (rev 24164)
@@ -22,7 +22,6 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/types.h>
 #include <sys/wait.h>
 
 #include "bswap.h"
@@ -151,10 +150,10 @@
 	char *path;
 	struct library *next;
 };
-struct library *lib_list = NULL;
-char not_found[] = "not found";
-char *interp_name = NULL;
-char *interp_dir = NULL;
+static struct library *lib_list = NULL;
+static char not_found[] = "not found";
+static char *interp_name = NULL;
+static char *interp_dir = NULL;
 static int byteswap;
 static int interpreter_already_found = 0;
 
@@ -526,7 +525,7 @@
 			tmp1++;
 		}
 		if (strcmp(tmp2, s) == 0) {
-			//printf("find_elf_interpreter is skipping '%s' (already in list)\n", cur->name);
+			/*printf("find_elf_interpreter is skipping '%s' (already in list)\n", cur->name); */
 			return 0;
 		}
 	}
@@ -544,7 +543,7 @@
 	/* Now try and locate where this library might be living... */
 	locate_library_file(ehdr, dynamic, is_setuid, newlib);
 
-	//printf("add_library is adding '%s' to '%s'\n", newlib->name, newlib->path);
+	/*printf("add_library is adding '%s' to '%s'\n", newlib->name, newlib->path); */
 	if (!lib_list) {
 		lib_list = newlib;
 	} else {
@@ -597,7 +596,7 @@
 		for (cur = lib_list; cur; cur = cur->next) {
 			/* Check if this library is already in the list */
 			if (strcmp(cur->name, tmp1) == 0) {
-				//printf("find_elf_interpreter is replacing '%s' (already in list)\n", cur->name);
+				/*printf("find_elf_interpreter is replacing '%s' (already in list)\n", cur->name); */
 				newlib = cur;
 				free(newlib->name);
 				if (newlib->path != not_found) {
@@ -619,7 +618,7 @@
 		newlib->next = NULL;
 
 #if 0
-		//printf("find_elf_interpreter is adding '%s' to '%s'\n", newlib->name, newlib->path);
+		/*printf("find_elf_interpreter is adding '%s' to '%s'\n", newlib->name, newlib->path); */
 		if (!lib_list) {
 			lib_list = newlib;
 		} else {
@@ -760,8 +759,8 @@
 	struct library *cur;
 
 	if (argc < 2) {
-		fprintf(stderr, "ldd: missing file arguments\n");
-		fprintf(stderr, "Try `ldd --help' for more information.\n");
+		fprintf(stderr, "ldd: missing file arguments\n"
+				"Try `ldd --help' for more information.\n");
 		exit(EXIT_FAILURE);
 	}
 	if (argc > 2)
@@ -776,8 +775,8 @@
 		}
 
 		if (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0) {
-			fprintf(stderr, "Usage: ldd [OPTION]... FILE...\n");
-			fprintf(stderr, "\t--help\t\tprint this help and exit\n");
+			fprintf(stderr, "Usage: ldd [OPTION]... FILE...\n"
+					"\t--help\t\tprint this help and exit\n");
 			exit(EXIT_SUCCESS);
 		}
 




More information about the uClibc-cvs mailing list