aboutsummaryrefslogtreecommitdiff
path: root/sbin/ldconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ldconfig')
-rw-r--r--sbin/ldconfig/Makefile10
-rw-r--r--sbin/ldconfig/ldconfig.82
-rw-r--r--sbin/ldconfig/ldconfig.c36
3 files changed, 30 insertions, 18 deletions
diff --git a/sbin/ldconfig/Makefile b/sbin/ldconfig/Makefile
index d27f9b7eea17..f565cf1fa4bc 100644
--- a/sbin/ldconfig/Makefile
+++ b/sbin/ldconfig/Makefile
@@ -1,12 +1,12 @@
-# $Id: Makefile,v 1.4 1993/11/09 20:39:46 paul Exp $
+# $Id: Makefile,v 1.7 1993/12/10 05:10:22 mycroft Exp $
PROG= ldconfig
SRCS= ldconfig.c shlib.c etc.c
LDDIR?= $(.CURDIR)/..
-LDFLAGS += -static
-CFLAGS += -I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE) -O
-BINDIR= /sbin
-MAN8 = ldconfig.8
+CFLAGS+=-I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE)
+LDSTATIC=-static
+BINDIR= /sbin
+MAN8= ldconfig.8
.PATH: $(LDDIR) $(LDDIR)/$(MACHINE)
diff --git a/sbin/ldconfig/ldconfig.8 b/sbin/ldconfig/ldconfig.8
index 78439e5f669f..170b6183eb87 100644
--- a/sbin/ldconfig/ldconfig.8
+++ b/sbin/ldconfig/ldconfig.8
@@ -1,6 +1,6 @@
.Dd October 3, 1993
.Dt LDCONFIG 8
-.Os FreeBSD
+.Os FreeBSD 1.1
.Sh NAME
.Nm ldconfig
.Nd configure the shared library cache
diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c
index 899539de21f8..fafe176dd34e 100644
--- a/sbin/ldconfig/ldconfig.c
+++ b/sbin/ldconfig/ldconfig.c
@@ -14,7 +14,7 @@
* must display the following acknowledgement:
* This product includes software developed by Paul Kranenburg.
* 4. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
+ * derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -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.2 1993/11/09 04:19:22 paul Exp $
+ * $Id: ldconfig.c,v 1.4 1993/12/02 01:03:16 jkh Exp $
*/
#include <sys/param.h>
@@ -72,7 +72,7 @@ struct shlib_list {
static struct shlib_list *shlib_head = NULL, **shlib_tail = &shlib_head;
static void enter __P((char *, char *, char *, int *, int));
-static int dodir __P((char *));
+static int dodir __P((char *, int));
static int build_hints __P((void));
int
@@ -114,10 +114,10 @@ char *argv[];
std_search_dirs(NULL);
for (i = 0; i < n_search_dirs; i++)
- rval |= dodir(search_dirs[i]);
+ rval |= dodir(search_dirs[i], 1);
for (i = optind; i < argc; i++)
- rval |= dodir(argv[i]);
+ rval |= dodir(argv[i], 0);
rval |= build_hints();
@@ -125,8 +125,9 @@ char *argv[];
}
int
-dodir(dir)
+dodir(dir, silent)
char *dir;
+int silent;
{
DIR *dd;
struct dirent *dp;
@@ -134,7 +135,8 @@ char *dir;
int dewey[MAXDEWEY], ndewey;
if ((dd = opendir(dir)) == NULL) {
- perror(dir);
+ if (!silent || errno != ENOENT)
+ perror(dir);
return -1;
}
@@ -314,16 +316,26 @@ build_hints()
return -1;
}
- mywrite(&hdr, 1, sizeof(struct hints_header), fd);
- mywrite(blist, hdr.hh_nbucket, sizeof(struct hints_bucket), fd);
- mywrite(strtab, strtab_sz, 1, fd);
-
+ if (write(fd, &hdr, sizeof(struct hints_header)) !=
+ sizeof(struct hints_header)) {
+ perror(_PATH_LD_HINTS);
+ return -1;
+ }
+ if (write(fd, blist, hdr.hh_nbucket * sizeof(struct hints_bucket)) !=
+ hdr.hh_nbucket * sizeof(struct hints_bucket)) {
+ perror(_PATH_LD_HINTS);
+ return -1;
+ }
+ if (write(fd, strtab, strtab_sz) != strtab_sz) {
+ perror(_PATH_LD_HINTS);
+ return -1;
+ }
if (close(fd) != 0) {
perror(_PATH_LD_HINTS);
return -1;
}
- /* Now, install real file */
+ /* Install it */
if (unlink(_PATH_LD_HINTS) != 0 && errno != ENOENT) {
perror(_PATH_LD_HINTS);
return -1;