All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix two compile time warnings
@ 2010-10-20  9:59 Maciej Żenczykowski
  2010-11-28 12:57 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej Żenczykowski @ 2010-10-20  9:59 UTC (permalink / raw)
  To: dash, Herbert Xu, maximillian attems; +Cc: Maciej Żenczykowski

From: Maciej Żenczykowski <maze@google.com>

jobs.c: In function 'sprint_status':
jobs.c:427: warning: format not a string literal and no format arguments

trap.c: In function 'exitshell':
trap.c:354: warning: variable 'status' might be clobbered by 'longjmp' or 'vfork'

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 src/jobs.c |    2 +-
 src/trap.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/jobs.c b/src/jobs.c
index 826a9af..44a6401 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -425,7 +425,7 @@ sprint_status(char *s, int status, int sigonly)
 				goto out;
 #endif
 		}
-		col = fmtstr(s, 32, strsignal(st));
+		col = fmtstr(s, 32, "%s", strsignal(st));
 		if (WCOREDUMP(status)) {
 			col += fmtstr(s + col, 16, " (core dumped)");
 		}
diff --git a/src/trap.c b/src/trap.c
index 7bd60ab..a3c4397 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -369,7 +369,7 @@ exitshell(void)
 {
 	struct jmploc loc;
 	char *p;
-	int status;
+	volatile int status;
 
 #ifdef HETIO
 	hetio_reset_term();
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix two compile time warnings
  2010-10-20  9:59 [PATCH] fix two compile time warnings Maciej Żenczykowski
@ 2010-11-28 12:57 ` Herbert Xu
  2010-11-29  7:18   ` Maciej Żenczykowski
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2010-11-28 12:57 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, dash, maximillian attems

On Wed, Oct 20, 2010 at 02:59:35AM -0700, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> jobs.c: In function 'sprint_status':
> jobs.c:427: warning: format not a string literal and no format arguments
> 
> trap.c: In function 'exitshell':
> trap.c:354: warning: variable 'status' might be clobbered by 'longjmp' or 'vfork'
> 
> Signed-off-by: Maciej Żenczykowski <maze@google.com>

Thanks for the patch.  I've applied the second hunk.

As for the first, if I get annoyed enough after upgrading my gcc
then I'll think about it :) It's a false positive as strsignal
should never return anything that requires "%s".

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix two compile time warnings
  2010-11-28 12:57 ` Herbert Xu
@ 2010-11-29  7:18   ` Maciej Żenczykowski
  2010-11-29  7:40     ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej Żenczykowski @ 2010-11-29  7:18 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash, maximillian attems

> Thanks for the patch.  I've applied the second hunk.
>
> As for the first, if I get annoyed enough after upgrading my gcc
> then I'll think about it :) It's a false positive as strsignal
> should never return anything that requires "%s".

That's unfortunate since it prevents a -Werror build of klibc (which
includes dash) from succeeding.
Cheers,
Maciej

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix two compile time warnings
  2010-11-29  7:18   ` Maciej Żenczykowski
@ 2010-11-29  7:40     ` Herbert Xu
  2010-11-29  8:52       ` Maciej Żenczykowski
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2010-11-29  7:40 UTC (permalink / raw)
  To: Maciej Żenczykowski; +Cc: dash, maximillian attems

On Sun, Nov 28, 2010 at 11:18:45PM -0800, Maciej Żenczykowski wrote:
> > Thanks for the patch.  I've applied the second hunk.
> >
> > As for the first, if I get annoyed enough after upgrading my gcc
> > then I'll think about it :) It's a false positive as strsignal
> > should never return anything that requires "%s".
> 
> That's unfortunate since it prevents a -Werror build of klibc (which
> includes dash) from succeeding.

And that's precisely why I would never use -Werror with gcc.

You can always apply this patch in klibc locally.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fix two compile time warnings
  2010-11-29  7:40     ` Herbert Xu
@ 2010-11-29  8:52       ` Maciej Żenczykowski
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2010-11-29  8:52 UTC (permalink / raw)
  To: Herbert Xu; +Cc: dash, maximillian attems

>> That's unfortunate since it prevents a -Werror build of klibc (which
>> includes dash) from succeeding.
>
> And that's precisely why I would never use -Werror with gcc.

My personal experience has been that the warnings gcc produces are far
more often a sign of real bugs
than they are spurious.  Usually fixing them isn't particularly bothersome.

(although this is based on experience predominantly gained not on klibc or dash)

> You can always apply this patch in klibc locally.

I do, however, I prefer submitting patches upstream whenever possible.

I'll continue to maintain this one locally.

- Maciej

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-29  8:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-20  9:59 [PATCH] fix two compile time warnings Maciej Żenczykowski
2010-11-28 12:57 ` Herbert Xu
2010-11-29  7:18   ` Maciej Żenczykowski
2010-11-29  7:40     ` Herbert Xu
2010-11-29  8:52       ` Maciej Żenczykowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.