[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in libc
From: |
Alexander Loksh |
Subject: |
bug in libc |
Date: |
Mon, 17 Jun 2002 10:19:25 -0400 |
Hi,
I am currently using RedHat Linux version 7.2. with libc 2.1.13
Before I was using RedHat Linux version 6.1 with libc 2.0.7.
While porting some software I found that it crushes on RedHat 7.2.
The reason of crush was due to the signal SIGPIPE.
I localized the problem.
Attached is the program which crashes on 7.2 but works on 6.1.
For my personal opinion the behavior on 6.1 is correct. The fprintf
statement returns -1, which indicates
that the fprintf() failed and program doesn't crush. On 7.2 the program
crushes, which is wrong.
It is not suppose to crush.
Regards
Alexander Loksh
======================test.c================================================
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#define GUESS 255
void closeAll(void);
main()
{
int socin, socin1, socin2;
int nRet = 0;
closeAll();
socin = socket(AF_INET, SOCK_STREAM, 0);
socin1 = socket(AF_INET, SOCK_STREAM, 0);
socin2 = socket(AF_INET, SOCK_STREAM, 0);
nRet=fprintf(stdout, "1\n");
nRet=fprintf(stderr, "1\n");
}
/*
Close all files.
*/
void closeAll(void)
{
long fdlimit = sysconf(_SC_OPEN_MAX);
if (fdlimit < 0)
fdlimit = GUESS;
for (; fdlimit > -1; fdlimit--)
close(fdlimit);
}
====================================Makefile================================
=======
CFLAGS = -g
test: test.o
cc -o test test.o
============================================================================
=====
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug in libc,
Alexander Loksh <=