Fix potential segfault when no rpmlock_path defined Resolves: 231146

This commit is contained in:
Paul Nasrat 2007-03-13 10:34:51 +00:00
parent b1ecfff518
commit f8e442e871

View File

@ -1,14 +1,17 @@
--- rpm-4.4.2/lib/rpmlock.c.userlock 2006-02-23 15:24:46.000000000 -0500 --- rpm-4.4.2/lib/rpmlock.c.userlock 2005-01-26 13:41:43.000000000 +0000
+++ rpm-4.4.2/lib/rpmlock.c 2006-02-23 15:25:53.000000000 -0500 +++ rpm-4.4.2/lib/rpmlock.c 2007-03-13 10:33:15.000000000 +0000
@@ -37,7 +37,7 @@ @@ -37,9 +37,9 @@
/* XXX oneshot to determine path for fcntl lock. */ /* XXX oneshot to determine path for fcntl lock. */
if (rpmlock_path == NULL) { if (rpmlock_path == NULL) {
- char * t = rpmExpand(rpmlock_path_default, NULL); - char * t = rpmExpand(rpmlock_path_default, NULL);
+ char * t = rpmGenPath(rootdir, rpmlock_path_default, NULL); + char * t = rpmGenPath(rootdir, rpmlock_path_default, NULL);
if (t == NULL || *t == '\0' || *t == '%') if (t == NULL || *t == '\0' || *t == '%')
t = RPMLOCK_PATH; - t = RPMLOCK_PATH;
+ t = strdup(RPMLOCK_PATH);
rpmlock_path = xstrdup(t); rpmlock_path = xstrdup(t);
t = _free(t);
}
@@ -129,7 +129,7 @@ @@ -129,7 +129,7 @@
const char *rootDir = rpmtsRootDir(ts); const char *rootDir = rpmtsRootDir(ts);
rpmlock lock; rpmlock lock;