On Sun, 9 Jan 2005 13:19:53 +0100, Corinna Vinschen
<[EMAIL PROTECTED]> wrote:
>
> Could you please prepare a short testcase, only containing the
> necessary lines to reproduce the problem?
>
> Thanks,
> Corinna
>
I have attached 2 files to reproduce the problem. It is linked to the
putenv() call and the env variable then being reset.
Regards,
Eric
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int
main(argc, argv)
int argc;
char *argv[];
{
int Pid;
int ret;
int Pfd[2];
int Flags;
char *cmd[] = { "ReadHandler",(char *)0 };
static char fooflags[64];
printf("Entering PacketServer\n");
strcpy(fooflags,"fooflags=1");
putenv(fooflags);
*fooflags = '\0'; /* remove from environment after all */
switch ( Pid = fork() ) {
case -1: /* Fork failed */
perror("StartReadHandler: fork() failed");
return(-1);
break; /* NOT REACHED */
case 0: /* Child process (will become
read-handler) */
ret = execv ("./ReadHandler", cmd);
perror("StartReadHandler: execv() failed");
exit(-1);
default: /* Parent process */
printf("Leaving PacketServer \n");
return(0);
} /* End of switch */
}
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
void perror(const char *s);
#include <errno.h>
/***** definitions *****/
int
main(argc, argv)
int argc;
char *argv[];
{
int fd;
fprintf(stderr,"ReadHandler starting.\n");
fd = 0;
if ( ( fd = socket(AF_INET, SOCK_DGRAM, 0) ) == -1 ) {
perror("socket:");
fprintf(stderr,"Can't create UDP receive socket: socket()");
return(-1);
}
fprintf(stderr,"Socket created OK. \n");
return(0);
}
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/