public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "steelman at post dot pl" <sourceware-bugzilla@sources.redhat.com> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/814] New: perror(3) generates an error Date: Fri, 01 Apr 2005 16:31:00 -0000 [thread overview] Message-ID: <20050401163034.814.steelman@post.pl> (raw) The perror(3) function generates an error that "overwrites" errno value. Try to compile and run the code below and you'll get: open: Success write: Illegal seek close: Illegal seek However manpage for errno(3) says that errno is meaningful only after an errornous call, IMHO perror should not change it's value. I suggest restoring the errno(3) value just befor return from perror(3). As i watched the strace(1) output for the example programme there was an _lseek call which returned an ESPIPE. -----EXAMPLE CODE----- #include <stdio.h> #include <fcntl.h> int main(int ac, char* av[]) { int fd; fd=open("/dev/null", O_WRONLY); perror("open"); write(fd, "/dev/null", 10); perror("write"); close(fd); perror("close"); return 0; } -----EXAMPLE CODE------ -- Summary: perror(3) generates an error Product: glibc Version: 2.3.4 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: gotom at debian dot or dot jp ReportedBy: steelman at post dot pl CC: glibc-bugs at sources dot redhat dot com GCC build triplet: i486-slackware-linux GCC host triplet: i486-slackware-linux GCC target triplet: i486-slackware-linux http://sources.redhat.com/bugzilla/show_bug.cgi?id=814 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2005-04-01 16:31 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-04-01 16:31 steelman at post dot pl [this message] 2005-04-01 17:38 ` [Bug libc/814] " schwab at suse dot de 2005-04-01 19:42 ` schwab at suse dot de 2005-04-01 19:43 ` schwab at suse dot de 2005-04-02 13:11 ` gotom at debian dot or dot jp 2005-04-02 13:12 ` gotom at debian dot or dot jp 2005-04-02 17:07 ` jakub at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050401163034.814.steelman@post.pl \ --to=sourceware-bugzilla@sources.redhat.com \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).