summaryrefslogtreecommitdiff
path: root/rpm.c
diff options
context:
space:
mode:
authorroot <devnull@localhost>1996-08-20 14:29:41 +0000
committerroot <devnull@localhost>1996-08-20 14:29:41 +0000
commitf574c657ece3e1794a65c8f7bc8028ee1a402f10 (patch)
tree2bb2ab20c1461f10a56f85edf12ffceef14a94ab /rpm.c
parent9c30ac18f9b9766df71f4c6d64b6b9e4a28c1325 (diff)
downloadrpm-f574c657ece3e1794a65c8f7bc8028ee1a402f10.tar.gz
rpm-f574c657ece3e1794a65c8f7bc8028ee1a402f10.tar.bz2
rpm-f574c657ece3e1794a65c8f7bc8028ee1a402f10.zip
complain if spec file is not a regular file
CVS patchset: 970 CVS date: 1996/08/20 14:29:41
Diffstat (limited to 'rpm.c')
-rwxr-xr-xrpm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/rpm.c b/rpm.c
index fea894635..d089e8984 100755
--- a/rpm.c
+++ b/rpm.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "install.h"
#include "lib/rpmerr.h"
@@ -210,6 +211,7 @@ int build(char *arg, int buildAmount, char *passPhrase,
Spec s;
char * specfile;
int res = 0;
+ struct stat statbuf;
if (arg[0] == '/') {
specfile = arg;
@@ -221,6 +223,12 @@ int build(char *arg, int buildAmount, char *passPhrase,
strcat(specfile, arg);
}
+ stat(specfile, &statbuf);
+ if (! S_ISREG(statbuf.st_mode)) {
+ error(RPMERR_BADSPEC, "File is not a regular file: %s\n", specfile);
+ return 1;
+ }
+
if (!(f = fopen(specfile, "r"))) {
fprintf(stderr, _("unable to open: %s\n"), specfile);
return 1;