* [PATCH] swapon: use xalloc lib
@ 2011-07-19 23:17 Davidlohr Bueso
2011-07-21 16:54 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2011-07-19 23:17 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
From: Davidlohr Bueso <dave@gnu.org>
Date: Mon, 18 Jul 2011 00:33:20 -0400
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
mount/swapon.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/mount/swapon.c b/mount/swapon.c
index 49771f5..6dfe4b1 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -24,6 +24,7 @@
#include "swapheader.h"
#include "mangle.h"
#include "canonicalize.h"
+#include "xalloc.h"
#include "c.h"
#define PATH_MKSWAP "/sbin/mkswap"
@@ -341,10 +342,8 @@ swap_get_header(int fd, int *sig, unsigned int *pagesize)
*pagesize = 0;
*sig = 0;
- buf = malloc(MAX_PAGESIZE);
- if (!buf)
- return NULL;
-
+ buf = xmalloc(MAX_PAGESIZE);
+
datasz = read(fd, buf, MAX_PAGESIZE);
if (datasz == (ssize_t) -1)
goto err;
@@ -658,16 +657,12 @@ static const char **ulist = NULL;
static int ulct = 0;
static void addl(const char *label) {
- llist = (const char **) realloc(llist, (++llct) * sizeof(char *));
- if (!llist)
- exit(EXIT_FAILURE);
+ llist = (const char **) xrealloc(llist, (++llct) * sizeof(char *));
llist[llct-1] = label;
}
static void addu(const char *uuid) {
- ulist = (const char **) realloc(ulist, (++ulct) * sizeof(char *));
- if (!ulist)
- exit(EXIT_FAILURE);
+ ulist = (const char **) xrealloc(ulist, (++ulct) * sizeof(char *));
ulist[ulct-1] = uuid;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] swapon: use xalloc lib
2011-07-19 23:17 [PATCH] swapon: use xalloc lib Davidlohr Bueso
@ 2011-07-21 16:54 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-07-21 16:54 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: util-linux
On Tue, Jul 19, 2011 at 07:17:55PM -0400, Davidlohr Bueso wrote:
> mount/swapon.c | 15 +++++----------
> 1 files changed, 5 insertions(+), 10 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-21 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-19 23:17 [PATCH] swapon: use xalloc lib Davidlohr Bueso
2011-07-21 16:54 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox