mdadm/mdadm-3.1.5-unused-param.patch
Doug Ledford 7e15eefc27 Rework the last fix to avoid an unheeded return error
Signed-off-by: Doug Ledford <dledford@redhat.com>
2011-03-26 14:16:54 -04:00

120 lines
3.5 KiB
Diff

--- mdadm-3.1.5/Query.c.param 2011-03-22 21:19:09.000000000 -0400
+++ mdadm-3.1.5/Query.c 2011-03-26 13:33:23.864978486 -0400
@@ -35,7 +35,7 @@ int Query(char *dev)
int fd = open(dev, O_RDONLY);
int vers;
int ioctlerr;
- int superror, superrno;
+ int superror;
struct mdinfo info;
mdu_array_info_t array;
struct supertype *st = NULL;
@@ -84,7 +84,6 @@ int Query(char *dev)
st = guess_super(fd);
if (st) {
superror = st->ss->load_super(st, fd, dev);
- superrno = errno;
} else
superror = -1;
close(fd);
--- mdadm-3.1.5/Grow.c.param 2011-03-22 21:19:09.000000000 -0400
+++ mdadm-3.1.5/Grow.c 2011-03-26 13:33:23.866978629 -0400
@@ -2016,7 +2016,6 @@ int Grow_continue(int mdfd, struct super
unsigned long long *offsets;
int d;
struct mdinfo *sra, *sd;
- int rv;
unsigned long cache;
int done = 0;
@@ -2102,7 +2101,6 @@ int Grow_continue(int mdfd, struct super
if (fds[sd->disk.raid_disk] < 0) {
fprintf(stderr, Name ": %s: cannot open component %s\n",
info->sys_name, dn?dn:"-unknown-");
- rv = 1;
goto release;
}
free(dn);
--- mdadm-3.1.5/mdadm.c.param 2011-03-22 21:19:09.000000000 -0400
+++ mdadm-3.1.5/mdadm.c 2011-03-26 13:33:23.889980281 -0400
@@ -101,7 +101,9 @@ int main(int argc, char *argv[])
char *shortopt = short_options;
int dosyslog = 0;
int rebuild_map = 0;
+#if 0
int auto_update_home = 0;
+#endif
char *subarray = NULL;
int print_help = 0;
@@ -1217,11 +1219,13 @@ int main(int argc, char *argv[])
cnt++;
acnt++;
}
+#if 0
if (rv2 == 1)
/* found something so even though assembly failed we
* want to avoid auto-updates
*/
auto_update_home = 0;
+#endif
} while (rv2!=2);
/* Incase there are stacked devices, we need to go around again */
} while (acnt);
--- mdadm-3.1.5/super1.c.param 2011-03-26 13:51:30.166019581 -0400
+++ mdadm-3.1.5/super1.c 2011-03-26 13:55:02.995382097 -0400
@@ -111,7 +111,6 @@ static unsigned int calc_sb_1_csum(struc
unsigned long long newcsum;
int size = sizeof(*sb) + __le32_to_cpu(sb->max_dev)*2;
unsigned int *isuper = (unsigned int*)sb;
- int i;
/* make sure I can count... */
if (offsetof(struct mdp_superblock_1,data_offset) != 128 ||
@@ -123,7 +122,7 @@ static unsigned int calc_sb_1_csum(struc
disk_csum = sb->sb_csum;
sb->sb_csum = 0;
newcsum = 0;
- for (i=0; size>=4; size -= 4 ) {
+ for (; size>=4; size -= 4 ) {
newcsum += __le32_to_cpu(*isuper);
isuper++;
}
@@ -387,13 +386,10 @@ static void examine_super1(struct supert
printf(" Array State : ");
for (d=0; d<__le32_to_cpu(sb->raid_disks) + delta_extra; d++) {
int cnt = 0;
- int me = 0;
unsigned int i;
for (i=0; i< __le32_to_cpu(sb->max_dev); i++) {
unsigned int role = __le16_to_cpu(sb->dev_roles[i]);
if (role == d) {
- if (i == __le32_to_cpu(sb->dev_number))
- me = 1;
cnt++;
}
}
--- mdadm-3.1.5/sysfs.c.param 2011-03-26 14:03:54.206714522 -0400
+++ mdadm-3.1.5/sysfs.c 2011-03-26 14:16:12.101936859 -0400
@@ -422,7 +422,7 @@ int sysfs_set_num(struct mdinfo *sra, st
int sysfs_uevent(struct mdinfo *sra, char *event)
{
char fname[50];
- int n;
+ unsigned int n;
int fd;
sprintf(fname, "/sys/block/%s/uevent",
@@ -432,6 +432,11 @@ int sysfs_uevent(struct mdinfo *sra, cha
return -1;
n = write(fd, event, strlen(event));
close(fd);
+ if (n != strlen(event)) {
+ dprintf(Name ": failed to write '%s' to '%s' (%s)\n",
+ event, fname, strerror(errno));
+ return -1;
+ }
return 0;
}