diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2022-05-06 10:23:50 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2022-05-06 11:08:35 +0300 |
commit | b1bc46e56a9c267ca7e5ed263c4649dae017914b (patch) | |
tree | 9be5dcd88be0243d252a4f65667bcc89480b9da7 /lib/fprint.c | |
parent | b204a9037bc25ac2bc2c511b0046234be72c5498 (diff) | |
download | rpm-b1bc46e56a9c267ca7e5ed263c4649dae017914b.tar.gz |
Rely on POSIX.1-2008 realpath() semantics in fingerprinting code
Since we're requiring POSIX.1-2008 now, we can rely on realpath()
being sane as well. Turns out we've been relying on that in the
debuginfo build-id code since 2016 already (commit
bbfe1f86b2e4b5c0bd499d9f3dd9de9c9c20fff2), oops. But then, nobody
has complained...
No functional changes.
Diffstat (limited to 'lib/fprint.c')
-rw-r--r-- | lib/fprint.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/fprint.c b/lib/fprint.c index a0488ea9f..f097834e1 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -150,11 +150,7 @@ static char * canonDir(rpmstrPool pool, rpmsid dirNameId) /* if the current directory doesn't exist, we might fail. oh well. likewise if it's too long. */ - - /* XXX we should let realpath() allocate if it can */ - cdnbuf = xmalloc(PATH_MAX); - cdnbuf[0] = '\0'; - if (realpath(".", cdnbuf) != NULL) { + if ((cdnbuf = realpath(".", NULL)) != NULL) { char *end = cdnbuf + strlen(cdnbuf); if (end[-1] != '/') *end++ = '/'; end = stpncpy(end, dirName, PATH_MAX - (end - cdnbuf)); @@ -163,8 +159,6 @@ static char * canonDir(rpmstrPool pool, rpmsid dirNameId) end = cdnbuf + strlen(cdnbuf); if (end[-1] != '/') *end++ = '/'; *end = '\0'; - } else { - cdnbuf = _free(cdnbuf); } } return cdnbuf; |