Fixed a bug in the handling of the directories in the search path

that is stored in the hints file.  If that search path contained
a non-existent directory (one, say, that had been removed), and
"ldconfig -m /a/perfectly/good/directory" was run, ldconfig returned
an error status without printing an error message.  This caused
some confusing bombs when installing ports, in particular.

I changed it so that non-existent directories from the stored search
path are silently ignored.  Only non-existent directories named
explicitly on the command line are treated as errors.  Also, a
diagnostic is printed if and only if an error status is returned.

In an unrelated fix, ldconfig now silently ignores any directories
named on the command line when the "-r" option is given.  Formerly,
these directories incorrectly made their way into the "search
directories" line of the listing.  It really should be an error to
specify directories together with "-r", but I don't have time to
fix the manual page in that way right now.

2.2 Candidate.
This commit is contained in:
John Polstra 1996-11-08 02:12:40 +00:00
parent 9fa75c1550
commit d66f9d22f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19522
2 changed files with 26 additions and 10 deletions

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ldconfig.c,v 1.14 1996/10/01 01:31:51 peter Exp $
* $Id: ldconfig.c,v 1.15 1996/10/10 23:14:23 jdp Exp $
*/
#include <sys/param.h>
@ -136,8 +136,15 @@ char *argv[];
if (!nostd && !merge)
std_search_path();
for (i = optind; i < argc; i++)
add_search_path(argv[i]);
if (!justread) { /* Add any directories from the command line */
for (i = optind; i < argc; i++) {
if (access(argv[i], F_OK) == -1) { /* Doesn't exist */
warn("%s", argv[i]);
rval = -1;
} else
add_search_path(argv[i]);
}
}
for (i = 0; i < n_search_dirs; i++) {
char *cp = concat(dir_list, *dir_list?":":"", search_dirs[i]);
@ -169,8 +176,9 @@ int silent;
int dewey[MAXDEWEY], ndewey;
if ((dd = opendir(dir)) == NULL) {
if (!silent || errno != ENOENT)
warn("%s", dir);
if (silent && errno == ENOENT) /* Ignore the error */
return 0;
warn("%s", dir);
return -1;
}

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ldconfig.c,v 1.14 1996/10/01 01:31:51 peter Exp $
* $Id: ldconfig.c,v 1.15 1996/10/10 23:14:23 jdp Exp $
*/
#include <sys/param.h>
@ -136,8 +136,15 @@ char *argv[];
if (!nostd && !merge)
std_search_path();
for (i = optind; i < argc; i++)
add_search_path(argv[i]);
if (!justread) { /* Add any directories from the command line */
for (i = optind; i < argc; i++) {
if (access(argv[i], F_OK) == -1) { /* Doesn't exist */
warn("%s", argv[i]);
rval = -1;
} else
add_search_path(argv[i]);
}
}
for (i = 0; i < n_search_dirs; i++) {
char *cp = concat(dir_list, *dir_list?":":"", search_dirs[i]);
@ -169,8 +176,9 @@ int silent;
int dewey[MAXDEWEY], ndewey;
if ((dd = opendir(dir)) == NULL) {
if (!silent || errno != ENOENT)
warn("%s", dir);
if (silent && errno == ENOENT) /* Ignore the error */
return 0;
warn("%s", dir);
return -1;
}