public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kirill at shutemov dot name" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/11319] New: dprintf doesn't handle errors proprerly Date: Wed, 24 Feb 2010 11:30:00 -0000 [thread overview] Message-ID: <20100224113031.11319.kirill@shutemov.name> (raw) According to manpage dprintf(3) (actually return value described in manpage for printf(3)) should return a negative value, if an output error is encountered. But dprintf(3) return positive value, if underlying write(2) returns -1 and sets errno=EINVAL. $ cat dprintf_test.c #include <errno.h> #include <stdio.h> #include <string.h> #include <sys/eventfd.h> int main(int argc, char **argv) { int ret; int fd = eventfd(0, 0); /* * man 2 eventfd: * * A write(2) will fail with the error EINVAL if the size of the supplied * buffer is less than 8 bytes... */ ret = dprintf(fd, "%d", 0); printf("%d: %s\n", ret, strerror(errno)); return 0; } $ gcc -o dprintf_test dprintf_test.c $ ./dprintf_test 1: Invalid argument $ strace ./dprintf_test ... eventfd2(0, 0) = 3 ... write(3, "0", 1) = -1 EINVAL (Invalid argument) ... -- Summary: dprintf doesn't handle errors proprerly Product: glibc Version: 2.11 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: kirill at shutemov dot name CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=11319 ------- 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:[~2010-02-24 11:30 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-02-24 11:30 kirill at shutemov dot name [this message] 2010-02-25 0:09 ` [Bug libc/11319] " drepper 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=20100224113031.11319.kirill@shutemov.name \ --to=sourceware-bugzilla@sourceware.org \ --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).