Bug 837090

Summary: Man page for inet_aton provides incorrect example
Product: [Fedora] Fedora Reporter: W. Michael Petullo <mike>
Component: man-pagesAssignee: Peter Schiffer <pschiffe>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: mtk.manpages, pschiffe
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-25 06:21:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description W. Michael Petullo 2012-07-02 18:11:21 UTC
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 14:24:17 UTC
rawhide build:
man-pages-3.42-1.fc19
http://koji.fedoraproject.org/koji/buildinfo?buildID=355232

Comment 2 Fedora Update System 2012-09-19 14:37:38 UTC
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 06:01:23 UTC
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 10:32:25 UTC
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 11:53:35 UTC
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 06:21:57 UTC
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 23:40:50 UTC
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);
     }