[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#62799: Possible incorrect data type in putenv prototype in stdlib.h



Package: libc6-dev
Version: 2.1.3-8

Compiles of maildrop fail with message indicating conflicting data types,
for example

c++ -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -I./../rfc822 -I./../rfc2045 -I./.. -Wall -c reformail.C
reformail.C: In function `void split(int, char **, int)':
reformail.C:1370: conversion to `char *' from `const char *' discards qualifiers
make[1]: *** [reformail.o] Error 1
make[1]: Leaving directory `/var/src/maildrop-0.99.1/maildrop'
make: *** [all-recursive] Error 1

This is from a compile of maildrop by Sam Varshavchik <mrsam@geocities.com>,
a far more competent C++ programmer than am I.  On reporting the problem to
Sam, he replied as follows.

> The problem is a bug in your stdlib.h
>                                                                       
> Your stdlib.h protoypes putenv(char *), and it should really be
> putenv(const char *).  You can either fix your include file, or manually
> insert a cast at the offending line.

The following change to stdlib.h effectively solved the problem


--- stdlib.h~   Mon Apr  3 11:26:51 2000
+++ stdlib.h    Fri Apr 21 10:49:44 2000
@@ -537,7 +537,7 @@
 /* The SVID says this is in <stdio.h>, but this seems a better place.  */
 /* Put STRING, which is of the form "NAME=VALUE", in the environment.
    If there is no =', remove NAME from the environment.  */
-extern int putenv __P ((char *__string));
+extern int putenv __P ((__const char *__string));
 #endif
 
 #ifdef __USE_BSD


Mr. Sam is a highly regarded open source author of many extremely useful
mail tools.  If his analysis is in error, please engage him in a dialog
directly on this and cc me on any exchange.

Thanks!

-- 
Lindsay Haisley       | "Everything works    |     PGP public key
FMP Computer Services |       if you let it" |      available at
fmouse@fmp.com        |    (The Roadie)      | <http://www.fmp.com/pubkeys>
http://www.fmp.com    |                      |


Reply to: