Mail Archives: cygwin/2005/01/10/16:55:05
------=_Part_1595_17252633.1105394091053
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Sun, 9 Jan 2005 13:19:53 +0100, Corinna Vinschen
<corinna-cygwin AT cygwin DOT com> 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
------=_Part_1595_17252633.1105394091053
Content-Type: text/plain; name="PacketServer.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="PacketServer.c"
#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[] =3D { "ReadHandler",(char *)0 };
static char fooflags[64];
=09
printf("Entering PacketServer\n");
strcpy(fooflags,"fooflags=3D1");
putenv(fooflags);
*fooflags =3D '\0'; /* remove from environment after all */
switch ( Pid =3D fork() ) {
case -1: /* Fork failed */
perror("StartReadHandler: fork() failed");
return(-1);
break; /* NOT REACHED */
case 0: /* Child process (will become read-handler) */
ret =3D execv ("./ReadHandler", cmd);
perror("StartReadHandler: execv() failed");
exit(-1);
default: /* Parent process */
printf("Leaving PacketServer \n");
return(0);
} /* End of switch */
}
------=_Part_1595_17252633.1105394091053
Content-Type: text/plain; name="ReadHandler.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="ReadHandler.c"
#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 =3D 0;
if ( ( fd =3D socket(AF_INET, SOCK_DGRAM, 0) ) =3D=3D -1 ) {
=09=20=20=20=20=09
perror("socket:");
fprintf(stderr,"Can't create UDP receive socket: socket()");
return(-1);
}
=09
fprintf(stderr,"Socket created OK. \n");
return(0);
}
------=_Part_1595_17252633.1105394091053
Content-Type: text/plain; charset=us-ascii
--
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/
------=_Part_1595_17252633.1105394091053--
- Raw text -