1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2007 H. Peter Anvin - All Rights Reserved
5 * This program is free software available under the same license
6 * as the "OpenBSD" operating system, distributed at
7 * http://www.openbsd.org/.
9 * ----------------------------------------------------------------------- */
14 * Minor help routines.
17 #include "config.h" /* Must be included first! */
22 * Set the signal handler and flags, and error out on failure.
24 void set_signal(int signum
, sighandler_t handler
, int flags
)
26 if (tftp_signal(signum
, handler
, flags
)) {
27 syslog(LOG_ERR
, "sigaction: %m");
33 * malloc() that syslogs an error message and bails if it fails.
35 void *tfmalloc(size_t size
)
37 void *p
= malloc(size
);
40 syslog(LOG_ERR
, "malloc: %m");
48 * strdup() that does the equivalent
50 char *tfstrdup(const char *str
)
52 char *p
= strdup(str
);
55 syslog(LOG_ERR
, "strdup: %m");