[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
errno values after fcntl() in glibc-2.2.1
From: |
Bryan Ericson |
Subject: |
errno values after fcntl() in glibc-2.2.1 |
Date: |
Tue, 20 Feb 2001 16:40:11 -0600 |
In working with glibc 2.2.1, I noticed an inconsistency in the
way fcntl() sets errno. fcntl() returns zero, but errno is
set to ENOSYS, as is demonstrated by running the following test
code:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
int
main(int argc, char **argv)
{
struct flock fl;
int fd;
int err;
int errnob;
fd = open("/etc/passwd", O_RDONLY);
if (fd == -1)
{
printf("can't open()\n");
return 1;
}
fl.l_type = F_RDLCK;
fl.l_whence = 0;
fl.l_start = 0;
fl.l_len = 0;
errno = 0;
err = fcntl (fd, F_SETLK, &fl);
errnob = errno;
if (err != 0)
{
printf("fcntl failed, errno %d\n", errnob);
return 1;
}
printf("fcntl passed, errno is %d\n", errnob);
return 0;
}
This was discovered on an i386 system running RedHat7. If possible,
please
let me know the status of this inconsistency.
Thank you,
Bryan Ericson
address@hidden
- errno values after fcntl() in glibc-2.2.1,
Bryan Ericson <=