Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jan 2000 10:16:05 +0100 (CET)
From:      un1i@rz.uni-karlsruhe.de
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/16056: [patch] ldconfig skips all command line params. if one is nonexistent
Message-ID:  <200001110916.KAA57093@i609.hadiko.de>

next in thread | raw e-mail | index | archive | help


>Number:         16056
>Category:       bin
>Synopsis:       [patch] ldconfig skips all command line params. if one is nonexistent
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 11 01:20:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Philipp Mergenthaler
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

FreeBSD i609.hadiko.de 4.0-CURRENT FreeBSD 4.0-CURRENT #120: Mon Jan 10 07:34:19 CET 2000     p@i609.hadiko.de:/usr/src/sys/compile/I609  i386

/usr/src/sbin/ldconfig/elfhints.c.orig:
     $FreeBSD: src/sbin/ldconfig/elfhints.c,v 1.2 1999/08/28 00:13:20 peter Exp $

>Description:

If one (or more) of the directories/files given as command line parameters
doesn't exist, ldconfig doesn't evaluate the others either.

This doesn't happen in -aout mode or when giving a file to ldconfig where
one directory entry doesn't exist. In these cases, ldconfig gives an error
message and treats the other files/directories correctly, i.e. enters them
into var/run/ld-elf.so.hints (resp. /var/run/ld.so.hints).
 
>How-To-Repeat:

ldconfig -r | wc
       2       3      47
ldconfig /usr/lib /foo
ldconfig: /foo: No such file or directory
ldconfig -r | wc      
       2       3      47

#for comparison:

echo /foo > ld
echo /usr/lib >> ld 
ldconfig ld 
ldconfig -r | wc   
      67     199    2595


>Fix:

--- elfhints.c.orig	Tue Jan 11 09:37:29 2000
+++ elfhints.c	Tue Jan 11 09:34:34 2000
@@ -216,12 +216,14 @@
 	for (i = 0;  i < argc;  i++) {
 		struct stat	s;
 
-		if (stat(argv[i], &s) == -1)
-			err(1, "%s", argv[i]);
-		if (S_ISREG(s.st_mode))
-			read_dirs_from_file(hintsfile, argv[i]);
-		else
-			add_dir(hintsfile, argv[i]);
+		if (stat(argv[i], &s) == -1) {
+			warn("%s", argv[i]);
+                } else {
+			if (S_ISREG(s.st_mode))
+				read_dirs_from_file(hintsfile, argv[i]);
+			else
+				add_dir(hintsfile, argv[i]);
+		}
 	}
 	write_elf_hints(hintsfile);
 }

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001110916.KAA57093>