summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-12-02 17:07:29 +0000
committerjbj <devnull@localhost>1999-12-02 17:07:29 +0000
commit2b8dc2ee5bee229a7e7886ee79e9dd4b2f8c6922 (patch)
tree79d1c558be3e9b1ae93a9907348abbbc7f46b935 /build
parent7e8b64d33591bad6c877d6fe7660107cb339d7f5 (diff)
downloadlibrpm-tizen-2b8dc2ee5bee229a7e7886ee79e9dd4b2f8c6922.tar.gz
librpm-tizen-2b8dc2ee5bee229a7e7886ee79e9dd4b2f8c6922.tar.bz2
librpm-tizen-2b8dc2ee5bee229a7e7886ee79e9dd4b2f8c6922.zip
fail to package if absolute symlink points within build root.
CVS patchset: 3452 CVS date: 1999/12/02 17:07:29
Diffstat (limited to 'build')
-rw-r--r--build/files.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/build/files.c b/build/files.c
index 24b6e3c9e..7b3b4c3f9 100644
--- a/build/files.c
+++ b/build/files.c
@@ -886,8 +886,20 @@ static void genCpioListAndHeader(struct FileList *fl,
&s, 1);
buf[0] = '\0';
- if (S_ISLNK(flp->fl_mode))
- buf[readlink(flp->diskURL, buf, BUFSIZ)] = '\0';
+ if (S_ISLNK(flp->fl_mode)) {
+ buf[Readlink(flp->diskURL, buf, BUFSIZ)] = '\0';
+ if (fl->buildRootURL) {
+ const char * buildRoot;
+ (void) urlPath(fl->buildRootURL, &buildRoot);
+
+ if (buf[0] == '/' && strcmp(buildRoot, "/") &&
+ !strncmp(buf, buildRoot, strlen(buildRoot))) {
+ rpmError(RPMERR_BADSPEC, _("Symlink points to BuildRoot: %s -> %s"),
+ flp->fileURL, buf);
+ fl->processingFailed = 1;
+ }
+ }
+ }
s = buf;
headerAddOrAppendEntry(h, RPMTAG_FILELINKTOS, RPM_STRING_ARRAY_TYPE,
&s, 1);