Questions tagged [errno]

errno is an integer variable, which is set by system calls and some library functions in the event of an error to indicate what went wrong. Its value is significant only when the return value of the call indicated an error.

errno is an integer variable, which is set by system calls and some library functions in the event of an error to indicate what went wrong. Its value is significant only when the return value of the call indicated an error.

559 questions
33
votes
2 answers

How to catch Errno::ECONNRESET class in "case when"?

My application (Ruby 1.9.2) may raise different exceptions, including net-connection breaks. I rescue Exception => e, then do case/when to handle them in defferent ways, but several errors go through my cases straight to else. rescue Exception => e …
Nakilon
  • 34,866
  • 14
  • 107
  • 142
32
votes
2 answers

Which systems define EAGAIN and EWOULDBLOCK as different values?

Just curious. Which systems providing both EAGAIN and EWOULDBLOCK #define them as different values?
pilcrow
  • 56,591
  • 13
  • 94
  • 135
28
votes
4 answers

How to get the errno of an IOError?

C has perror and errno, which print and store the last error encountered. This is convenient when doing file io as I do not have to fstat() every file that fails as an argument to fopen() to present the user with a reason why the call failed. I was…
jr0d
  • 935
  • 2
  • 8
  • 9
25
votes
6 answers

Access to errno from Python?

I am stuck with a fairly complex Python module that does not return useful error codes (it actually fails disturbingly silently). However, the underlying C library it calls sets errno. Normally errno comes in over OSError attributes, but since I…
user79758
24
votes
1 answer

Redirect perror output to fprintf(stderr, " ")

In case a system call function fails, we normally use perror to output the error message. I want to use fprintf to output the perror string. How can I do something like this: fprintf(stderr, perror output string here);
RajSanpui
  • 11,556
  • 32
  • 79
  • 146
24
votes
1 answer

Write to /tmp directory in aws lambda with python

Goal I'm trying to write a zip file to the /tmp folder in a python aws lambda, so I can extract manipulate before zipping, and placing it in s3 bucket. Problem Os Errno30 Read Only FileSystem This code was tested locally on my computer to make sure…
Codyj110
  • 548
  • 1
  • 5
  • 13
24
votes
3 answers

How to check the value of errno?

I am using a system call and in case it fails, I need to do different things for different errnos. I need to write code that looks something like this: int res; res = systemCall(); if (res == -1) { if (errno == ENOMSG) { …
Hana
  • 535
  • 2
  • 7
  • 17
22
votes
1 answer

GetLastError(), errno, FormatMessageA() and strerror_s()?

I'm confused as to the exact relationship between GetLastError() and errno. Are they the same numerical values, or something completely different? How do I know which one I should check? And if I want to convert an error code to a string for…
Stéphane
  • 19,459
  • 24
  • 95
  • 136
20
votes
3 answers

C++ alternative to perror()

I know we can use perror() in C to print errors. I was just wondering if there is a C++ alternative to this, or whether I have to include this (and therefore stdio.h) in my program. I am trying to avoid as many C functions as possible.
Sagar
  • 9,456
  • 6
  • 54
  • 96
20
votes
5 answers

Why can't errno's value be printed?

I am looking at the following code in an SO "Low Quality" post to make sure the sample works, and my question is why can't I print errno's value? #include #include #include int main(){ FILE *fp; errno = 0; …
octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
18
votes
5 answers

Python [Errno 13] Permission denied:

I'm attempting to write a quick python script to iterate through all csv files in the current folder and remove the header row from them then store them in a separate folder. The current working directory has four sample csv files and the python…
digital_alchemy
  • 663
  • 4
  • 9
  • 19
17
votes
2 answers

Difference between EACCES and EPERM

What is the difference between EACCES and EPERM exactly? EPERM is described here as "not super user", but I would usually associate that with EACCES. In fact, I can't recall ever seeing an EPERM in real life.
George Simms
  • 3,930
  • 4
  • 21
  • 35
16
votes
6 answers

Return Code on failure. Positive or negative?

a C-programm can fail to execute under special circumstances in Linux. Example: You allocate some space and the OS denies it. char *buffer = (char *) malloc(1024); if (buffer == NULL) return ENOMEM; This failure is marked by the return code…
cominfotty
  • 441
  • 1
  • 6
  • 10
15
votes
1 answer

error: use of undeclared identifier 'errno_t'

Here is my dead simple dummy code: #include int main(void) { errno_t e; return 0; } Which surprisingly raises this error: main.c:5:5: error: use of undeclared identifier 'errno_t' errno_t x; ^ I started to follow the…
Peter Varo
  • 11,726
  • 7
  • 55
  • 77
15
votes
2 answers

TCP Connect error 115 Operation in Progress What is the Cause?

My application creats a TCP connection, This is working normaly. But in one network server has many IP say 174.X.X.X 54.x.x.x like this When calling TCP connect (Non blocking with timeout of 60 seconds) to IP 174.X.X.X is always success . But…
Syed Shamsheer
  • 193
  • 1
  • 2
  • 8
1
2
3
37 38