?
Solved

system errno 9

Posted on 2003-03-17
6
Medium Priority
?
4,683 Views
Last Modified: 2012-06-21
COuld someone please tellme what errno 9 (Bad file number) means... perhaps with an example... I am using errno in a straight C application that I built to run on a solaris machine... I have been using this code for a while and never got this error number before... now I am receiving it all the time with no changes to the code... I am stumped... I do not know what to make of errno 9 (Bad FIle Number).

please provide an example of what might cause this to occur if possible...

any insight???

rechard
0
Comment
Question by:rechard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:jcaldwel
ID: 8155828
It usually means that the file descriptor is not an open descriptor.

Error check your open() call... make sure that the fd returned != -1

0
 

Author Comment

by:rechard
ID: 8155886
jcaldwel

does this strictly pertain to open() or fopen() as well.. It may seem like a dumb question.. but after looking online and after reading your comment... it says that this error usually occurs when a call to open(), dup() or fcntl() has occurred... or is fopen() thrown in with open()... or does this error only pertain to open(), etc...?

what do u think???

rechard
0
 
LVL 1

Expert Comment

by:jcaldwel
ID: 8155910
fopen returns NULL on error.

I would imagine you would get the same error in STDIO functions if the underlying UNIX file descriptor is not opened.


0
 
LVL 8

Accepted Solution

by:
ssnkumar earned 80 total points
ID: 8157118
rechard,
you get error #9 (bad file number), when the file descriptor you are using is not valid. Either the file descriptor refers to no open file, or a read (or write) request is made to a file that is open only for writing
(or reading).
If you are doing socket programming, the socket descriptor has got closed before you could do any operation on that and you may end up with this error.
But, without seeing the code, it is very difficult to point to the exact solution.

-Narendra
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10143793
Nothing has happened on this question in more than 9 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by ssnkumar.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question