aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-04-13 00:48:10 +0200
committerMattias Andrée <maandree@kth.se>2019-04-13 00:48:10 +0200
commitb1e498418e51ee1b22be7e85c5d29e3f31cae9c8 (patch)
tree64668c549d2d0d944c133aaeb6d0afff5919dc48
parentFix makefile (diff)
downloadliberror-libc-b1e498418e51ee1b22be7e85c5d29e3f31cae9c8.tar.gz
liberror-libc-b1e498418e51ee1b22be7e85c5d29e3f31cae9c8.tar.bz2
liberror-libc-b1e498418e51ee1b22be7e85c5d29e3f31cae9c8.tar.xz
Prefetch backtrace so that it does not contain functions used to set the error
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--abs.c1
-rw-r--r--imaxabs.c1
-rw-r--r--labs.c1
-rw-r--r--llabs.c1
-rw-r--r--pipe.c1
-rw-r--r--putenv.c1
-rw-r--r--set_error_one_file.c1
-rw-r--r--setenv.c1
-rw-r--r--shutdown.c1
-rw-r--r--unsetenv.c1
10 files changed, 10 insertions, 0 deletions
diff --git a/abs.c b/abs.c
index ebfcf14..71d73b5 100644
--- a/abs.c
+++ b/abs.c
@@ -10,6 +10,7 @@ liberror_abs(int i)
#else
if (i != INT_MIN)
return abs(i);
+ liberror_save_backtrace(NULL);
liberror_set_error_errno("The absolute value of largest negative integer "
"cannot be represented as a signed integer",
"abs", EOVERFLOW);
diff --git a/imaxabs.c b/imaxabs.c
index cffacc2..22d3d10 100644
--- a/imaxabs.c
+++ b/imaxabs.c
@@ -10,6 +10,7 @@ liberror_imaxabs(intmax_t i)
#else
if (i != INTMAX_MIN)
return imaxabs(i);
+ liberror_save_backtrace(NULL);
liberror_set_error_errno("The absolute value of largest negative integer "
"cannot be represented as a signed integer",
"imaxabs", EOVERFLOW);
diff --git a/labs.c b/labs.c
index 3979dff..7e1ea0a 100644
--- a/labs.c
+++ b/labs.c
@@ -10,6 +10,7 @@ liberror_labs(long int i)
#else
if (i != LONG_MIN)
return labs(i);
+ liberror_save_backtrace(NULL);
liberror_set_error_errno("The absolute value of largest negative integer "
"cannot be represented as a signed integer",
"labs", EOVERFLOW);
diff --git a/llabs.c b/llabs.c
index edf4c82..6aa6362 100644
--- a/llabs.c
+++ b/llabs.c
@@ -10,6 +10,7 @@ liberror_llabs(long long int i)
#else
if (i != LLONG_MIN)
return llabs(i);
+ liberror_save_backtrace(NULL);
liberror_set_error_errno("The absolute value of largest negative integer "
"cannot be represented as a signed integer",
"llabs", EOVERFLOW);
diff --git a/pipe.c b/pipe.c
index a4b44c2..3c0fed5 100644
--- a/pipe.c
+++ b/pipe.c
@@ -27,6 +27,7 @@ liberror_pipe(int fds[2])
break;
}
error:
+ liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, "pipe", errno);
return -1;
}
diff --git a/putenv.c b/putenv.c
index b88b3cd..18cf2cf 100644
--- a/putenv.c
+++ b/putenv.c
@@ -22,6 +22,7 @@ liberror_putenv(char *string)
return 0;
}
error:
+ liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, "putenv", errno);
return -1;
}
diff --git a/set_error_one_file.c b/set_error_one_file.c
index f8061f8..b9b46d1 100644
--- a/set_error_one_file.c
+++ b/set_error_one_file.c
@@ -7,6 +7,7 @@ liberror_libc_set_error_one_file(const char desc[256], const char source[64], co
{
struct liberror_error *error;
int saved_errno = errno;
+ liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, source, saved_errno);
error = liberror_get_error();
error->details_type = LIBERROR_DETAILS_ONE_FILE;
diff --git a/setenv.c b/setenv.c
index 157fea2..0bb7831 100644
--- a/setenv.c
+++ b/setenv.c
@@ -25,6 +25,7 @@ liberror_setenv(const char *envname, const char *envval, int overwrite)
desc = "Environment variable name contains the '=' character";
}
error:
+ liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, "setenv", errno);
return -1;
}
diff --git a/shutdown.c b/shutdown.c
index 4e5f4cf..ca6049b 100644
--- a/shutdown.c
+++ b/shutdown.c
@@ -28,6 +28,7 @@ liberror_shutdown(int fd, int how, const char *fname)
desc = "";
break;
}
+ liberror_save_backtrace(NULL);
liberror_libc_set_error_one_file(desc, "shutdown", "Socket file", fd, fname);
return -1;
}
diff --git a/unsetenv.c b/unsetenv.c
index 6f7db37..1462618 100644
--- a/unsetenv.c
+++ b/unsetenv.c
@@ -18,6 +18,7 @@ liberror_unsetenv(const char *name)
desc = "Environment variable name contains the '=' character";
}
error:
+ liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, "setenv", errno);
return -1;
}