Bug #187
closedTwo trivial patches for /bin/sh
0%
Description
I wanted to submit these before I attempt any serious surgery on /bin/sh.
These two patches mostly bring /bin/sh up to WARNS?=3. They don't correct
the "comparison is always true due to limited range of data type" errors that
also appear on WARNS?=0.
The eval.c patch fixes possible logjmp clobbering. The histedit.c patch fixes
a warning of possibly returning an uninitialized value from str_to_event. (I
initialize 'i' as well for good measure.)
Index: eval.c
===================================================================
RCS file: /home/dcvs/src/bin/sh/eval.c,v
retrieving revision 1.5
diff u -p -r1.5 eval.c eval.c 12 May 2006 01:56:11 -0000 1.5
--
++ eval.c 4 Jun 2006 08:15:20 -0000@ -977,6 +977,12
@ struct jmploc loc, old;
struct strlist *sp;
const char *path;
int ch;
#ifdef GNUC
+ / Avoid longjmp clobbering */
+ (void) &path;
+ (void) &argc;
+ (void) &argv;
+#endif
===================================================================
RCS file: /home/dcvs/src/bin/sh/histedit.c,v
retrieving revision 1.7
diff u -p -r1.7 histedit.c histedit.c 17 Jan 2006 15:06:26 -0000 1.7
--
+++ histedit.c 25 May 2006 19:05:33 -0000@ -441,6 +441,7
@ const char *s = str;
int relative = 0;
int i, retval;
for (sp = cmdenviron; sp ; sp = sp->next)
setvareq(sp->text, VEXPORT|VSTACK);
Index: histedit.c
+ i = retval = 0;
history(hist, &he, H_FIRST);
switch (*s) {
case '-':
Files
Updated by dillon about 19 years ago
:I wanted to submit these before I attempt any serious surgery on /bin/sh.
:
:These two patches mostly bring /bin/sh up to WARNS?=3D3. They don't corre=
:ct=20
:the "comparison is always true due to limited range of data type" errors th=
:at=20
:also appear on WARNS?=3D0.
:
:The eval.c patch fixes possible logjmp clobbering. The histedit.c patch fix=
:es=20
:a warning of possibly returning an uninitialized value from str_to_event. (=
:I=20
:initialize 'i' as well for good measure.)
These patches didn't patch cleanly but since they are so trivial I
was able to patch them in manually.
I did something slightly different for histedit.c. I only initiialized
retval. 'i' doesn't need initialization at the top.
-Matt