summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2003-04-01 17:31:32 +0000
committerMike Fulbright <msf@redhat.com>2003-04-01 17:31:32 +0000
commit0eab0d69fb0f53bb3c654bbe53383dca7e329c91 (patch)
tree2a15a5f1b6232d080084d6cd71e574638a2bfa00 /utils
parent43257be7dcfd9ce5e12580412fe2d0556e592f14 (diff)
downloadanaconda-0eab0d69fb0f53bb3c654bbe53383dca7e329c91.tar.gz
anaconda-0eab0d69fb0f53bb3c654bbe53383dca7e329c91.tar.xz
anaconda-0eab0d69fb0f53bb3c654bbe53383dca7e329c91.zip
added sanity check that package order file isnt something stupid like a traceback
Diffstat (limited to 'utils')
-rw-r--r--utils/genhdlist.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/genhdlist.c b/utils/genhdlist.c
index e7df661db..826c438b1 100644
--- a/utils/genhdlist.c
+++ b/utils/genhdlist.c
@@ -58,6 +58,23 @@ int pkgListAlloced = 0;
char ** depOrder = NULL;
hashTable requireTable;
+/* make sure its <package>-<version>-<release> */
+int sanityCheckDepOrderLine(char *line) {
+ char *r, *v;
+
+
+ r = strrchr(line, '-');
+ if (!r)
+ return -1;
+
+ v = strrchr(r, '-');
+ if (!v)
+ return -1;
+
+ return 0;
+
+}
+
/* mmmm... linear search */
int getOrder (char * fn)
{
@@ -455,6 +472,15 @@ int main(int argc, const char ** argv) {
len = strlen(b);
/* chop */
b[--len] = '\0';
+
+ /* sanity check */
+ /* should have the format of a <package name>-<version>-<release> */
+ if (sanityCheckDepOrderLine(b)) {
+ fprintf(stderr, "genhdlist: FATAL ERROR -> \"%s\" is not a package name!!\n",b);
+ fprintf(stderr, "Your package list file %s is most likely CORRUPT!\n", depOrderFile);
+ exit(1);
+ }
+
depOrder[numpkgs] = malloc (len + 1);
strcpy (depOrder[numpkgs], b);
numpkgs++;