Bug 837090 - Man page for inet_aton provides incorrect example
Man page for inet_aton provides incorrect example
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: man-pages (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Peter Schiffer
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-02 14:11 EDT by W. Michael Petullo
Modified: 2013-02-09 18:40 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-25 02:21:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description W. Michael Petullo 2012-07-02 14:11:21 EDT
Description of problem:
The man page for inet_aton provides an incorrect example:

[...]
if (inet_aton(argv[1], &addr) == 0) {
    perror("inet_aton");
    exit(EXIT_FAILURE);
}
[...]

Version-Release number of selected component (if applicable):
man-pages-3.35-2.fc17.noarch

How reproducible:
Every time

Steps to Reproduce:
1. man inet_aton
2. Compile example from man page to a.out
  
Actual results:
> ./a.out not-an-ip-address
inet_aton: Success

Expected results:
The example should not recommend using perror. inet_aton is not a system call and perror prints "Success" even on an error. Instead, the example should use fprintf (stderr, ...).

Additional info:
Comment 1 Peter Schiffer 2012-09-19 10:24:17 EDT
rawhide build:
man-pages-3.42-1.fc19
http://koji.fedoraproject.org/koji/buildinfo?buildID=355232
Comment 2 Fedora Update System 2012-09-19 10:37:38 EDT
man-pages-3.42-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/man-pages-3.42-1.fc18
Comment 3 Fedora Update System 2012-09-20 02:01:23 EDT
Package man-pages-3.42-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing man-pages-3.42-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-14421/man-pages-3.42-1.fc18
then log in and leave karma (feedback).
Comment 4 Fedora Update System 2012-09-20 06:32:25 EDT
man-pages-3.35-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/man-pages-3.35-3.fc17
Comment 5 Fedora Update System 2012-09-20 07:53:35 EDT
man-pages-3.35-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/man-pages-3.35-4.fc17
Comment 6 Fedora Update System 2012-09-25 02:21:57 EDT
man-pages-3.42-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 7 Michael Kerrisk 2013-02-09 18:40:50 EST
I've applied the following upstream:

diff --git a/man3/inet.3 b/man3/inet.3
index c4b3200..51ca844 100644
--- a/man3/inet.3
+++ b/man3/inet.3
@@ -286,7 +286,7 @@ main(int argc, char *argv[])
     }
 
     if (inet_aton(argv[1], &addr) == 0) {
-        perror("inet_aton");
+        fprintf(stderr, "Invalid address\\n");
         exit(EXIT_FAILURE);
     }

Note You need to log in before you can comment on or make changes to this bug.