Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/pkg_install/add Pull up revision 1.13 (request...
details: https://anonhg.NetBSD.org/src/rev/82611d58ff60
branches: netbsd-1-4
changeset: 469704:82611d58ff60
user: he <he%NetBSD.org@localhost>
date: Thu Nov 11 21:51:10 1999 +0000
description:
Pull up revision 1.13 (requested by abs):
Do not crash if realpath() fails, which can happen if current
directory is no longer valid.
diffstat:
usr.sbin/pkg_install/add/main.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r 5b0d8157e917 -r 82611d58ff60 usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c Thu Nov 11 21:47:03 1999 +0000
+++ b/usr.sbin/pkg_install/add/main.c Thu Nov 11 21:51:10 1999 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: main.c,v 1.9.2.2 1999/09/13 21:36:28 he Exp $ */
+/* $NetBSD: main.c,v 1.9.2.3 1999/11/11 21:51:10 he Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.9.2.2 1999/09/13 21:36:28 he Exp $");
+__RCSID("$NetBSD: main.c,v 1.9.2.3 1999/11/11 21:51:10 he Exp $");
#endif
#endif
@@ -129,14 +129,22 @@
char *s;
if (fexists(*argv)) { /* refers to a file directly */
- lpp = alloc_lpkg(realpath(*argv, pkgname));
+ if (!(cp = realpath(*argv, pkgname))) {
+ lpp = NULL;
+ warn("realpath failed for '%s'", *argv);
+ } else
+ lpp = alloc_lpkg(cp);
} else if (ispkgpattern(*argv)
&& (s = findbestmatchingname(dirname_of(*argv),
basename_of(*argv))) != NULL) {
if (Verbose)
printf("Using %s for %s\n", s, *argv);
- lpp = alloc_lpkg(realpath(s, pkgname));
+ if (!(cp = realpath(s, pkgname))) {
+ lpp = NULL;
+ warn("realpath failed for '%s'", s);
+ } else
+ lpp = alloc_lpkg(cp);
} else {
/* look for the file(pattern) in the expected places */
if (!(cp = fileFindByPath(NULL, *argv))) {
Home |
Main Index |
Thread Index |
Old Index