[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
red hat 9 != 9.0
From: |
Paul Heinlein |
Subject: |
red hat 9 != 9.0 |
Date: |
Tue, 8 Apr 2003 09:56:59 -0700 (PDT) |
On Red Hat 9 systems, /etc/redhat-release reads
Red Hat Linux release 9 (Shrike)
src/misc.c won't parse this correctly because it scans for "%d.%d". I
guess there are two ways to set the classes:
* just let it be redhat_9
* by fiat, declare it both redhat_9 and redhat_9_0
The patch below, made against 2.0.6, takes the first approach, though
I certainly can understand the arguments for the second. (Warning: I'm
not a C hacker. This looks right to me, and it seems to work as
expected on Linux/gcc boxes, but any fixes are certainly welcome.)
--Paul Heinlein <heinlein@cse.ogi.edu>
--- src/misc.c.dist 2003-04-08 09:20:36.000000000 -0700
+++ src/misc.c 2003-04-08 09:34:32.000000000 -0700
@@ -802,9 +802,17 @@
else
{
release += strlen(RELEASE_FLAG);
- sscanf(release, "%d.%d", &major, &minor);
- sprintf(strmajor, "%d", major);
- sprintf(strminor, "%d", minor);
+ if (sscanf(release, "%d.%d", &major, &minor) == 2)
+ {
+ sprintf(strmajor, "%d", major);
+ sprintf(strminor, "%d", minor);
+ }
+ /* red hat 9 is *not* red hat 9.0. */
+ else if (sscanf(release, "%d", &major) == 1)
+ {
+ sprintf(strmajor, "%d", major);
+ minor = -2;
+ };
}
if(major != -1 && minor != -1 && vendor != "")
@@ -821,9 +829,12 @@
}
strcat(classbuf, strmajor);
AddClassToHeap(classbuf);
- strcat(classbuf, "_");
- strcat(classbuf, strminor);
- AddClassToHeap(classbuf);
+ if (minor != -2)
+ {
+ strcat(classbuf, "_");
+ strcat(classbuf, strminor);
+ AddClassToHeap(classbuf);
+ }
}
return 0;
}
- red hat 9 != 9.0,
Paul Heinlein <=