summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/config.c b/config.c
index 41f07d6..ad7e31c 100644
--- a/config.c
+++ b/config.c
@@ -91,11 +91,13 @@ int getconfstr(char *confname, char *filename, char* dest) {
// Returns the value of the configuration option with name
// 'confname' from configuration file 'filename'.
+// Sets errno to 0 on success, or ECONFINT if it fails, in which case the return value is undefined.
int getconfint(char *confname, char *filename) {
+ errno = 0;
char result[MAXCHAR];
if (!getconfstr(confname, filename, result)) {
- printf("getconfint(): error getting configuration option '%s' from configuration file '%s'.\n", confname, filename);
debugprint(DEBUG_CRIT, "getconfint(): error getting configuration option '%s' from configuration file '%s'.\n", confname, filename);
+ errno = ECONFINT;
}
return strtol(result, NULL, 10); // Convert resulting string to an integer, base 10