Sync with Debian Salsa [31ba2b1b10cfcc2149bb43fe9b918355177e4341], 2018-08-01

This commit is contained in:
Steffen Nurpmeso 2018-08-11 23:23:15 +02:00 committed by Juergen Daubert
parent 9d9e74493a
commit 122e382214

View File

@ -80,7 +80,6 @@
#include <sys/select.h>
#include <sys/ioctl.h>
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <time.h>
@ -192,7 +191,7 @@ enum {
};
/* The minimum polling interval, 20ms. */
static const long MIN_POLL_INTERVAL = 20 * NANOSEC_IN_MILLISEC;
static const long MIN_POLL_INTERVAL = 20L * NANOSEC_IN_MILLISEC;
static enum action_code action;
static bool testmode = false;
@ -302,6 +301,25 @@ fatal(const char *format, ...)
exit(2);
}
#define BUG(...) bug(__FILE__, __LINE__, __func__, __VA_ARGS__)
static void DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4)
bug(const char *file, int line, const char *func, const char *format, ...)
{
va_list arglist;
fprintf(stderr, "%s:%s:%d:%s: internal error: ",
progname, file, line, func);
va_start(arglist, format);
vfprintf(stderr, format, arglist);
va_end(arglist);
if (action == ACTION_STATUS)
exit(STATUS_UNKNOWN);
else
exit(3);
}
static void *
xmalloc(int size)
{
@ -940,7 +958,9 @@ parse_schedule(const char *schedule_str)
schedule[count].value = repeatat;
count++;
}
assert(count == schedule_length);
if (count != schedule_length)
BUG("count=%d != schedule_length=%d",
count, schedule_length);
}
}
@ -1289,10 +1309,16 @@ proc_get_psinfo(pid_t pid, struct psinfo *psinfo)
fp = fopen(filename, "r");
if (!fp)
return false;
if (fread(psinfo, sizeof(*psinfo), 1, fp) == 0)
if (fread(psinfo, sizeof(*psinfo), 1, fp) == 0) {
fclose(fp);
return false;
if (ferror(fp))
}
if (ferror(fp)) {
fclose(fp);
return false;
}
fclose(fp);
return true;
}
@ -2463,7 +2489,7 @@ run_stop_schedule(void)
else if (userspec)
set_what_stop("process(es) owned by '%s'", userspec);
else
fatal("internal error, no match option, please report");
BUG("no match option, please report");
anykilled = false;
retry_nr = 0;
@ -2501,7 +2527,8 @@ run_stop_schedule(void)
else
continue;
default:
assert(!"schedule[].type value must be valid");
BUG("schedule[%d].type value %d is not valid",
position, schedule[position].type);
}
}