* fdopen() Bug
@ 1994-06-09 19:55 Cy Schubert - BCSC Open Systems Group
1994-06-11 17:04 ` Burkhard Neidecker-Lutz
0 siblings, 1 reply; 2+ messages in thread
From: Cy Schubert - BCSC Open Systems Group @ 1994-06-09 19:55 UTC (permalink / raw)
Has anoyone come across a bug in fdopen() where it complains about a vaild
argument list and core dumps? Here is a sample program. Is a fix available?
#include <stdio.h>
#include <sys/fcntl.h>
#include <errno.h>
main()
{
FILE *lockfile;
int lockfd, i;
char hostname[80];
lockfd = open("xyz", O_CREAT , S_IRUSR | S_IWUSR);
lockfile = fdopen(lockfd, "r");
perror("error at fdopen:");
printf("%d %d\n",lockfd,lockfile);
gethostname(hostname, sizeof(hostname));
fprintf(lockfile, "%s %d\n", hostname, getpid());
fclose(lockfile);
return 0;
close(lockfd);
}
Regards, Phone: (604)389-3827
Cy Schubert OV/VM: BCSC02(CSCHUBER)
Open Systems & MVS Support BITNET: CSCHUBER@BCSC02.BITNET
BC Systems Corp. Internet: cschuber@bcsc02.gov.bc.ca
cschuber@uumail.gov.bc.ca
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: fdopen() Bug
1994-06-09 19:55 fdopen() Bug Cy Schubert - BCSC Open Systems Group
@ 1994-06-11 17:04 ` Burkhard Neidecker-Lutz
0 siblings, 0 replies; 2+ messages in thread
From: Burkhard Neidecker-Lutz @ 1994-06-11 17:04 UTC (permalink / raw)
In article <1994Jun9.125544.4297@vmsmail.gov.bc.ca> cschuber@passer.osg.gov.bc.ca (Cy Schubert - BCSC Open Systems Group) writes:
>
>main()
>{
> FILE *lockfile;
> int lockfd, i;
> char hostname[80];
>
> lockfd = open("xyz", O_CREAT , S_IRUSR | S_IWUSR);
make that: open("xyz", O_CREAT | O_WRONLY , S_IRUSR | S_IWUSR);
> lockfile = fdopen(lockfd, "r");
make that: fdopen(lockfd, "w");
Burkhard Neidecker-Lutz
Distributed Multimedia Group, CEC Karlsruhe
Advanced Technology Group, Digital Equipment Corporation
neideck@nestvx.enet.dec.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-06-11 17:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-06-09 19:55 fdopen() Bug Cy Schubert - BCSC Open Systems Group
1994-06-11 17:04 ` Burkhard Neidecker-Lutz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox