2 * Copyright (C) 1995-1999 Jeffrey A. Uphoff
3 * Modified by Olaf Kirch, 1996.
4 * Modified by H.J. Lu, 1998.
21 * Error-checking malloc() wrapper.
29 return ((void *)NULL);
31 if (!(ptr = malloc (size)))
32 /* SHIT! SHIT! SHIT! */
33 die ("malloc failed");
40 * Error-checking strdup() wrapper.
43 xstrdup (const char *string)
47 /* Will only fail if underlying malloc() fails (ENOMEM). */
48 if (!(result = strdup (string)))
49 die ("strdup failed");
56 * Call with check=1 to verify that this host is not still on the rtnl
57 * before unlinking file.
60 xunlink (char *path, char *host, short int check)
64 tozap=alloca (strlen(path)+strlen(host)+2);
65 sprintf (tozap, "%s/%s", path, host);
67 if (!check || !nlist_gethost(rtnl, host, 0)) {
68 if (unlink (tozap) == -1)
69 note (N_ERROR, "unlink (%s): %s", tozap, strerror (errno));
71 dprintf (N_DEBUG, "Unlinked %s", tozap);
74 dprintf (N_DEBUG, "Not unlinking %s--host still monitored.", tozap);