LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-23-2006, 08:05 PM   #1
henry0712
LQ Newbie
 
Registered: Dec 2006
Posts: 5

Rep: Reputation: 0
Why the message of perror() is "success"?


hi, everybody:
In a c-program code, using the perror() function:
perror("functionname");
When the function return, the displayed message is:
functionname: Success

I found the explaination in man:
**********************************************
First (if s is not NULL and *s is not NUL) the argument string s is printed, followed by a colon and a blank. Then the message and a new-line.
**********************************************
How can I do know what the message is? When is it "Success" or other message?

thanks!
 
Old 12-23-2006, 08:51 PM   #2
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
I seems there is some confusion about what perror() does. Also from man, "The perror() function shall map the error number accessed through the symbol errno..."
If errno is 0 then "Success" will be printed after your message.
Is this what you mean?
 
Old 12-23-2006, 09:54 PM   #3
henry0712
LQ Newbie
 
Registered: Dec 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Thank randyding, yes, I see it. The message is the status of last function call , isn't it?
 
Old 12-23-2006, 10:15 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Actually the status of the last function call that failed, and only if that last call is a system or library one.

In the latter case, the library should have set the global variable errno.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: "Elephants Dream" film is an open source success story LXer Syndicated Linux News 0 05-26-2006 11:33 PM
FC4 install errors, "diabling IRQ #10" "nobody cares" error message??? A6Quattro Fedora 6 07-20-2005 12:49 PM
What is "read manifest failed: Success"? (RH 7.3, trouble installing RPMs) vfoo Linux - Software 1 07-06-2005 10:56 AM
SpamAssassin Error "spamd: no response to STREAM cmd, Success" and other errors PlorkZ Linux - Software 1 11-18-2004 04:16 PM
error message when pressing "Next" "BIOS Problems" , help ! HeRCuLeSX Fedora 3 07-21-2004 02:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration