Illegal seek in Unix Domain Socket
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Illegal seek in Unix Domain Socket




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Illegal seek in Unix Domain Socket  
Ole Jacob Hagen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-04 08:35 PM

Hi.

I am making an application that are interfaced from Octave by Unix
Domain sockets.

I am struggling with an error-message, which appears when I am using
perror-function, after I have read from socket. I am using read-function.

I discovered during compliation perror-function is deprecated, and
should be replaced with strerror. Is it?

If I am using the strerror instead of perror, I get no errors, but when
I use perror, errors might occur.

Any Comments?

Ole J.





[ Post a follow-up to this message ]



    Re: Illegal seek in Unix Domain Socket  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-04 08:35 PM

Ole Jacob Hagen <waterthrill@yahoo.no> writes:

> Hi.
>
> I am making an application that are interfaced from Octave by Unix
> Domain sockets.
>
> I am struggling with an error-message, which appears when I am using
> perror-function, after I have read from socket. I am using
> read-function.
>
> I discovered during compliation perror-function is deprecated, and
> should be replaced with strerror. Is it?
>
> If I am using the strerror instead of perror, I get no errors, but
> when I use perror, errors might occur.

Any error would have occurred before you call either of those
functions.  If whatever function you called prior to perror/strerror
returned an error indication there was an error, otherwise there
probably was none.

You mention "Illegal seek" and sockets in the subject line.  This
would indicate that you are trying to do a seek on a socket.
Obviously, this is impossible.

--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: Illegal seek in Unix Domain Socket  
Fletcher Glenn


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-04 10:34 PM



Ole Jacob Hagen wrote:
> Hi.
>
> I am making an application that are interfaced from Octave by Unix
> Domain sockets.
>
> I am struggling with an error-message, which appears when I am using
> perror-function, after I have read from socket. I am using read-function.
>
> I discovered during compliation perror-function is deprecated, and
> should be replaced with strerror. Is it?
>
> If I am using the strerror instead of perror, I get no errors, but when
> I use perror, errors might occur.
>
> Any Comments?
>
> Ole J.

perror or strerror will not produce meaningful errors unless read
returns -1.  If you are arbitrarily printing errors without checking
for -1, you can get leftover values in errno.

--

Fletcher Glenn






[ Post a follow-up to this message ]



    Re: Illegal seek in Unix Domain Socket  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-19-04 11:34 PM

In article <40844372.8010408@removethisfoglight.com>,
Fletcher Glenn <fletcher@removethisfoglight.com> wrote:

> Ole Jacob Hagen wrote: 
>
> perror or strerror will not produce meaningful errors unless read
> returns -1.  If you are arbitrarily printing errors without checking
> for -1, you can get leftover values in errno.

Another common mistake is to call some other functions in between
calling read() and calling perror(), e.g.

nread = read(...);
if (nread == -1) {
printf("read() returned an error.\n");
perror(...);
}

The problem with this is that the functions that printf() calls
internally may modify errno.  So you end up printing the message that
goes with that value, rather than the errno value that was set by
read().  If you must call other functions before calling perror(), you
have to save the original error; you can do this either by saving and
restoring the value of errno, or by calling strerror() to save the error
message string.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:26 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register