Use 'STDIN_FILENO' and STDOUT_FILENO' instead of sp'.

OSF's libc isn't quite prepared to have two different FILEs refer
to the same file descriptor.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1906 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-06-14 19:13:55 +00:00
parent 02c607db68
commit f290999528

View File

@@ -64,7 +64,6 @@ pop_init(POP *p,int argcount,char **argmessage)
int c;
int len;
int options = 0;
int sp = 0; /* Socket pointer */
char * trace_file_name = "/tmp/popper-trace";
int inetd = 0;
int portnum = 0;
@@ -161,7 +160,7 @@ pop_init(POP *p,int argcount,char **argmessage)
/* Get the address and socket of the client to whom I am speaking */
len = sizeof(cs);
if (getpeername(sp,(struct sockaddr *)&cs,&len) < 0){
if (getpeername(STDIN_FILENO, (struct sockaddr *)&cs, &len) < 0){
pop_log(p,POP_PRIORITY,
"Unable to obtain socket and address of client, err = %d",errno);
exit (1);
@@ -220,14 +219,14 @@ pop_init(POP *p,int argcount,char **argmessage)
}
/* Create input file stream for TCP/IP communication */
if ((p->input = fdopen(sp,"r")) == NULL){
if ((p->input = fdopen(STDIN_FILENO,"r")) == NULL){
pop_log(p,POP_PRIORITY,
"Unable to open communication stream for input, err = %d",errno);
exit (1);
}
/* Create output file stream for TCP/IP communication */
if ((p->output = fdopen(sp,"w")) == NULL){
if ((p->output = fdopen(STDOUT_FILENO,"w")) == NULL){
pop_log(p,POP_PRIORITY,
"Unable to open communication stream for output, err = %d",errno);
exit (1);