[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diffutils bug
From: |
Harti Brandt |
Subject: |
diffutils bug |
Date: |
Thu, 30 Oct 2003 14:43:44 +0100 (CET) |
Hi all,
diffutils/src/util.c contains the following line:
execl (pr_program, pr_program, "-h", name, 0);
Unfortunately this line invokes unspecified behaviour according to
C-rules, because for a variadic function the compiler cannot know, that
it has to convert the 0 to a null pointer. This is not a big problem
for systems where sizeof(char *) == sizeof(int) but breaks on other
systems. Note, that it is not enough to write
execl (pr_program, pr_program, "-h", name, NULL);
because the compiler cannot know that it has to convert the null pointer
constant NULL to a pointer. Whether you write 0 or NULL you must
explicitely convert this to a pointer. The following patch should help:
--- util.c.orig Thu Oct 30 14:38:50 2003
+++ util.c Thu Oct 30 14:38:19 2003
@@ -215,7 +215,7 @@
close (pipes[0]);
}
- execl (pr_program, pr_program, "-h", name, 0);
+ execl (pr_program, pr_program, "-h", name, (char *)NULL);
_exit (errno == ENOEXEC ? 126 : 127);
}
else
Best regards,
harti
--
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
address@hidden, address@hidden
- diffutils bug,
Harti Brandt <=