summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-09-28 12:12:07 -0700
committerDan Williams <dan.j.williams@intel.com>2008-10-15 14:15:52 -0700
commit3d2c4fc7b6bed924f8d5d1eae9a164b191e1b6da (patch)
treed8ade835972ae3cc8f1103dfcd036fefa91bd971 /super1.c
parent3f6efecc4ccc4b5e50ade7368cf825c372cda0cf (diff)
downloadmdadm-3d2c4fc7b6bed924f8d5d1eae9a164b191e1b6da.tar.gz
mdadm-3d2c4fc7b6bed924f8d5d1eae9a164b191e1b6da.tar.xz
mdadm-3d2c4fc7b6bed924f8d5d1eae9a164b191e1b6da.zip
trivial warn_unused_result squashing
Made the mistake of recompiling the F9 mdadm rpm which has a patch to remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots of errors: config.c:568: warning: ignoring return value of asprintf Assemble.c:411: warning: ignoring return value of asprintf Assemble.c:413: warning: ignoring return value of asprintf super0.c:549: warning: ignoring return value of posix_memalign super0.c:742: warning: ignoring return value of posix_memalign super0.c:812: warning: ignoring return value of posix_memalign super1.c:692: warning: ignoring return value of posix_memalign super1.c:1039: warning: ignoring return value of posix_memalign super1.c:1155: warning: ignoring return value of posix_memalign super-ddf.c:508: warning: ignoring return value of posix_memalign super-ddf.c:645: warning: ignoring return value of posix_memalign super-ddf.c:696: warning: ignoring return value of posix_memalign super-ddf.c:715: warning: ignoring return value of posix_memalign super-ddf.c:1476: warning: ignoring return value of posix_memalign super-ddf.c:1603: warning: ignoring return value of posix_memalign super-ddf.c:1614: warning: ignoring return value of posix_memalign super-ddf.c:1842: warning: ignoring return value of posix_memalign super-ddf.c:2013: warning: ignoring return value of posix_memalign super-ddf.c:2140: warning: ignoring return value of write super-ddf.c:2143: warning: ignoring return value of write super-ddf.c:2147: warning: ignoring return value of write super-ddf.c:2150: warning: ignoring return value of write super-ddf.c:2162: warning: ignoring return value of write super-ddf.c:2169: warning: ignoring return value of write super-ddf.c:2172: warning: ignoring return value of write super-ddf.c:2176: warning: ignoring return value of write super-ddf.c:2181: warning: ignoring return value of write super-ddf.c:2686: warning: ignoring return value of posix_memalign super-ddf.c:2690: warning: ignoring return value of write super-ddf.c:3070: warning: ignoring return value of posix_memalign super-ddf.c:3254: warning: ignoring return value of posix_memalign bitmap.c:128: warning: ignoring return value of posix_memalign mdmon.c:94: warning: ignoring return value of write mdmon.c:221: warning: ignoring return value of pipe mdmon.c:327: warning: ignoring return value of write mdmon.c:330: warning: ignoring return value of chdir mdmon.c:335: warning: ignoring return value of dup monitor.c:415: warning: rv may be used uninitialized in this function ...some of these like the write() ones are not so trivial so save those fixes for the next patch. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/super1.c b/super1.c
index b7cd962..a392cf6 100644
--- a/super1.c
+++ b/super1.c
@@ -689,8 +689,12 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
int rfd;
char defname[10];
- posix_memalign((void**)&sb, 512, (1024 + 512 +
- sizeof(struct misc_dev_info)));
+ if (posix_memalign((void**)&sb, 512, (1024 + 512 +
+ sizeof(struct misc_dev_info))) != 0) {
+ fprintf(stderr, Name
+ ": %s could not allocate superblock\n", __func__);
+ return 0;
+ }
memset(sb, 0, 1024);
st->sb = sb;
@@ -1036,9 +1040,13 @@ static int compare_super1(struct supertype *st, struct supertype *tst)
return 1;
if (!first) {
- posix_memalign((void**)&first, 512,
+ if (posix_memalign((void**)&first, 512,
1024 + 512 +
- sizeof(struct misc_dev_info));
+ sizeof(struct misc_dev_info)) != 0) {
+ fprintf(stderr, Name
+ ": %s could not allocate superblock\n", __func__);
+ return 1;
+ }
memcpy(first, second, 1024 + 512 +
sizeof(struct misc_dev_info));
st->sb = first;
@@ -1152,9 +1160,13 @@ static int load_super1(struct supertype *st, int fd, char *devname)
return 1;
}
- posix_memalign((void**)&super, 512,
+ if (posix_memalign((void**)&super, 512,
1024 + 512 +
- sizeof(struct misc_dev_info));
+ sizeof(struct misc_dev_info)) != 0) {
+ fprintf(stderr, Name ": %s could not allocate superblock\n",
+ __func__);
+ return 1;
+ }
if (read(fd, super, 1024) != 1024) {
if (devname)