summaryrefslogtreecommitdiffstats
path: root/misc-utils/rename.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2010-10-15 16:59:18 +0200
committerKarel Zak2010-10-21 10:31:50 +0200
commit87f3feac713c7aa652bb1d7e4e231ed06a960f4c (patch)
tree08a67efb1983277b4e32919d30235953dd4f9431 /misc-utils/rename.c
parentxalloc: general purpose memory allocation handling wrappers (diff)
downloadkernel-qcow2-util-linux-87f3feac713c7aa652bb1d7e4e231ed06a960f4c.tar.gz
kernel-qcow2-util-linux-87f3feac713c7aa652bb1d7e4e231ed06a960f4c.tar.xz
kernel-qcow2-util-linux-87f3feac713c7aa652bb1d7e4e231ed06a960f4c.zip
misc-utils: use new xmalloc() wrapper
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'misc-utils/rename.c')
-rw-r--r--misc-utils/rename.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index 87262b800..495e511c9 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -17,7 +17,9 @@ for i in $@; do N=`echo "$i" | sed "s/$FROM/$TO/g"`; mv "$i" "$N"; done
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+
#include "nls.h"
+#include "xalloc.h"
static char *progname;
@@ -33,11 +35,7 @@ do_rename(char *from, char *to, char *s) {
flen = strlen(from);
tlen = strlen(to);
slen = strlen(s);
- newname = malloc(tlen+slen+1);
- if (newname == NULL) {
- fprintf(stderr, _("%s: out of memory\n"), progname);
- exit(1);
- }
+ newname = xmalloc(tlen+slen+1);
p = s;
q = newname;