2 * Copyright (C) 1995-1999 Jeffrey A. Uphoff
3 * Modified by Olaf Kirch, 1996.
4 * Modified by H.J. Lu, 1998.
19 * Error-checking malloc() wrapper.
27 return ((void *)NULL);
29 if (!(ptr = malloc (size)))
30 /* SHIT! SHIT! SHIT! */
31 die ("malloc failed");
38 * Error-checking strdup() wrapper.
41 xstrdup (const char *string)
45 /* Will only fail if underlying malloc() fails (ENOMEM). */
46 if (!(result = strdup (string)))
47 die ("strdup failed");
54 * Call with check=1 to verify that this host is not still on the rtnl
55 * before unlinking file.
58 xunlink (char *path, char *host, short int check)
62 tozap=alloca (strlen(path)+strlen(host)+2);
63 sprintf (tozap, "%s/%s", path, host);
65 if (!check || !nlist_gethost(rtnl, host, 0)) {
66 if (unlink (tozap) == -1)
67 note (N_ERROR, "unlink (%s): %s", tozap, strerror (errno));
69 dprintf (N_DEBUG, "Unlinked %s", tozap);
72 dprintf (N_DEBUG, "Not unlinking %s--host still monitored.", tozap);