diff options
author | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:18:19 +0100 |
---|---|---|
committer | Paul Nasrat <pnasrat@redhat.com> | 2007-04-16 13:18:19 +0100 |
commit | d0c8cb4a15ce49f72b92f7eac5f429acca9cf24a (patch) | |
tree | 1ea0222421c2e298d45a387acc8a7d0d13f5cec4 /build.c | |
parent | 3c102d6404bdaa14c6553049f9cf1dcec127814a (diff) | |
download | librpm-tizen-d0c8cb4a15ce49f72b92f7eac5f429acca9cf24a.tar.gz librpm-tizen-d0c8cb4a15ce49f72b92f7eac5f429acca9cf24a.tar.bz2 librpm-tizen-d0c8cb4a15ce49f72b92f7eac5f429acca9cf24a.zip |
Check getcwd return value, abort if rpm cannot determine current
directory.
Patch from OpenSuSE
Diffstat (limited to 'build.c')
-rw-r--r-- | build.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -206,7 +206,10 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) directory for this run */ if (*arg != '/') { - (void)getcwd(buf, BUFSIZ); + if (!getcwd(buf, BUFSIZ)) { + rpmError(RPMERR_STAT, "getcwd failed: %m\n"); + return 1; + } strcat(buf, "/"); strcat(buf, arg); } else @@ -225,7 +228,11 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) specut = urlPath(specURL, &specFile); if (*specFile != '/') { char *s = alloca(BUFSIZ); - (void)getcwd(s, BUFSIZ); + if (!getcwd(s, BUFSIZ)) { + rpmError(RPMERR_STAT, "getcwd failed: %m\n"); + rc = 1; + goto exit; + } strcat(s, "/"); strcat(s, arg); specURL = s; |