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 xlog_err ("malloc failed");
39 * Error-checking strdup() wrapper.
42 xstrdup (const char *string)
46 /* Will only fail if underlying malloc() fails (ENOMEM). */
47 if (!(result = strdup (string)))
48 xlog_err ("strdup failed");
58 xunlink (char *path, char *host)
62 tozap = malloc(strlen(path)+strlen(host)+2);
64 xlog(L_ERROR, "xunlink: malloc failed: errno %d (%m)", errno);
67 sprintf (tozap, "%s/%s", path, host);
69 if (unlink (tozap) == -1)
70 xlog(L_ERROR, "unlink (%s): %m", tozap);
72 xlog(D_GENERAL, "Unlinked %s", tozap);