Merge remote-tracking branch 'sami/vapier'

This commit is contained in:
Craig Small 2012-01-24 22:36:28 +11:00
commit 8955ec26fe
7 changed files with 12 additions and 7 deletions

View File

@ -16,6 +16,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <error.h>
/* /*
* Compiler specific stuff * Compiler specific stuff

View File

@ -24,7 +24,7 @@ void *xmalloc(const size_t size)
{ {
void *ret = malloc(size); void *ret = malloc(size);
if (!ret && size) if (!ret && size)
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
return ret; return ret;
} }
@ -33,7 +33,7 @@ void *xrealloc(void *ptr, const size_t size)
{ {
void *ret = realloc(ptr, size); void *ret = realloc(ptr, size);
if (!ret && size) if (!ret && size)
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
return ret; return ret;
} }
@ -42,7 +42,7 @@ void *xcalloc(const size_t nelems, const size_t size)
{ {
void *ret = calloc(nelems, size); void *ret = calloc(nelems, size);
if (!ret && size && nelems) if (!ret && size && nelems)
err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); xerrx(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
return ret; return ret;
} }
@ -53,7 +53,7 @@ static inline char *xstrdup(const char *str)
return NULL; return NULL;
ret = strdup(str); ret = strdup(str);
if (!ret) if (!ret)
err(XALLOC_EXIT_CODE, "cannot duplicate string"); xerrx(XALLOC_EXIT_CODE, "cannot duplicate string");
return ret; return ret;
} }

View File

@ -8,11 +8,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details. * GNU Library General Public License for more details.
*/ */
#include <ctype.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "sig.h" #include "sig.h"
#include "c.h"
/* Linux signals: /* Linux signals:
* *
@ -221,7 +223,7 @@ char *strtosig(const char *restrict s){
copy = strdup(s); copy = strdup(s);
if (!copy) if (!copy)
err(EXIT_FAILURE, "cannot duplicate string"); xerrx(EXIT_FAILURE, "cannot duplicate string");
for (p = copy; *p != '\0'; p++) for (p = copy; *p != '\0'; p++)
*p = toupper(*p); *p = toupper(*p);
p = copy; p = copy;

View File

@ -17,6 +17,7 @@
#include <string.h> #include <string.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <error.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>

2
pwdx.c
View File

@ -96,7 +96,7 @@ int main(int argc, char *argv[])
char buf[10 + strlen(argv[i]) + 1]; char buf[10 + strlen(argv[i]) + 1];
if (check_pid_argument(argv[i])) if (check_pid_argument(argv[i]))
errx(EXIT_FAILURE, _("invalid process id: %s"), xerrx(EXIT_FAILURE, _("invalid process id: %s"),
argv[i]); argv[i]);
/* /*
* At this point, all arguments are in the form * At this point, all arguments are in the form

View File

@ -131,7 +131,7 @@ static void check_proc(int pid, struct run_time_conf_t *run_time)
if (fd == -1) { if (fd == -1) {
/* process exited maybe */ /* process exited maybe */
if (run_time->warnings) if (run_time->warnings)
warn(_("cannot open file %s"), buf); xwarn(_("cannot open file %s"), buf);
return; return;
} }
fstat(fd, &statbuf); fstat(fd, &statbuf);

View File

@ -31,6 +31,7 @@
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h>
#include <termios.h> #include <termios.h>
#include <termios.h> #include <termios.h>
#include <time.h> #include <time.h>