summaryrefslogtreecommitdiffstats
path: root/sys-utils/readprofile.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2010-10-27 11:14:46 +0200
committerKarel Zak2010-11-01 16:43:23 +0100
commit2ab428f6a8966d90ac97ce0ce0c7d73b82fade8f (patch)
tree81da9f5e03454912f8904d189c1ae4662a8d882c /sys-utils/readprofile.c
parentlibblkid: add signature to FAT32 fsinfo block (diff)
downloadkernel-qcow2-util-linux-2ab428f6a8966d90ac97ce0ce0c7d73b82fade8f.tar.gz
kernel-qcow2-util-linux-2ab428f6a8966d90ac97ce0ce0c7d73b82fade8f.tar.xz
kernel-qcow2-util-linux-2ab428f6a8966d90ac97ce0ce0c7d73b82fade8f.zip
sys-utils: make use xalloc wrappers
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'sys-utils/readprofile.c')
-rw-r--r--sys-utils/readprofile.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 52f5d8c94..91ff32951 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -49,6 +49,8 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/utsname.h>
+
+#include "xalloc.h"
#include "nls.h"
#define S_LEN 128
@@ -60,22 +62,6 @@ static char defaultmap[]="/boot/System.map";
static char defaultpro[]="/proc/profile";
static char optstring[]="M:m:np:itvarVbs";
-static void *
-xmalloc (size_t size) {
- void *t;
-
- if (size == 0)
- return NULL;
-
- t = malloc (size);
- if (t == NULL) {
- fprintf(stderr, _("out of memory"));
- exit(1);
- }
-
- return t;
-}
-
static FILE *
myopen(char *name, char *mode, int *flag) {
int len = strlen(name);
@@ -242,10 +228,7 @@ main(int argc, char **argv) {
exit(1);
}
- if (!(buf=malloc(len))) {
- fprintf(stderr,"%s: malloc(): %s\n", prgname, strerror(errno));
- exit(1);
- }
+ buf = xmalloc(len);
if (read(proFd,buf,len) != len) {
fprintf(stderr,"%s: %s: %s\n",prgname,proFile,strerror(errno));