summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@redhat.com>2007-04-16 13:18:19 +0100
committerPaul Nasrat <pnasrat@redhat.com>2007-04-16 13:18:19 +0100
commitd0c8cb4a15ce49f72b92f7eac5f429acca9cf24a (patch)
tree1ea0222421c2e298d45a387acc8a7d0d13f5cec4 /build.c
parent3c102d6404bdaa14c6553049f9cf1dcec127814a (diff)
downloadlibrpm-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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/build.c b/build.c
index 09f51e0ae..3c96a19ca 100644
--- a/build.c
+++ b/build.c
@@ -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;