Notes |
(0001704)
vda
10-15-06 11:25
|
+int raidautorun_main(int argc, char *argv[])
+{
+ int fd;
+
+ if (argc != 2)
+ bb_show_usage();
+
+ if ((fd = open(argv[1], O_RDONLY)) == -1) {
+ bb_error_msg("Can't open md device %s\n", argv[1]);
+ return EXIT_FAILURE;
+ }
+
+ if (ioctl(fd, RAID_AUTORUN, NULL) != 0) {
+ bb_error_msg("RAID_AUTORUN ioctl failed\n");
+ close (fd);
+ return EXIT_FAILURE;
+ }
+
+ close (fd);
+
+ return EXIT_SUCCESS;
+}
Please indent using tabs.
Please use xopen(), XXXXerror_msg_and_die()
Please do not place assignment in if(). |
| |
(0001708)
Thomas Jarosch
10-19-06 01:00
|
Ok, will do. Might take some time. |
| |
(0001709)
bernhardf
10-19-06 04:41
|
raidautorun.01c.patch
added a version that takes vda's comment into account. Still way too big ;)
text data bss dec hex filename
79 0 0 79 4f miscutils/raidautorun.o |
| |
(0001710)
bernhardf
10-19-06 07:01
|
busybox-raidautorun.01d.patch
Is what i'd check in;
text data bss dec hex filename
60 0 0 60 3c miscutils/raidautorun.o
thanks,
Bernhard |
| |
(0001713)
bernhardf
10-21-06 05:11
|
Thomas,
vda did check the applet in, please test if it's ok for you and report back so
i can close this issue.
After 2006-11-01, this issue will be closed if i don't hear anything back.
Thanks, |
| |
(0001714)
Thomas Jarosch
10-23-06 06:27
|
Hello Bernhard,
Thanks for doing the modifications. I'll test the new code tomorrow.
There are two concerns about the 01d revision:
1. You can't distinguish if it's a permission problem (/dev/md0 open failed)
or if the ioctl() failed.
2. Does is still show the usage if you call it without parameters?
I'll test this tomorrow.
Cheers,
Thomas |
| |
(0001716)
Thomas Jarosch
10-24-06 09:28
|
Hello Bernhard,
the new code runs fine. My only suggestion is to add the
if (argc != 2)
bb_show_usage();
part back in. Otherwise argv[1] could point to invalid memory.
Or does busybox somehow handle this magically?
Cheers,
Thomas |
| |
(0001717)
bernhardf
10-24-06 13:07
|
We don't handle this magically, no.
Added the check, fwiw.
text data bss dec hex filename
53 0 0 53 35 miscutils/raidautorun.o.r16429
65 0 0 65 41 miscutils/raidautorun.o
Fixed in r16430 |
| |