* frantisek holop min...@obiit.org [120511 22:42]:
hi there,
i am trying to trick /etc/hotplug/attach into mounting
the sd card from my android smartphone.
the principal problem seems to be that at the time
of e.g. sd2 showing up, the disklabel is not ready yet.
(maybe the delay is the time android needs to unmount it)
as no disklabel is ready, 'label:' is also empty and nothing
happens.
so i set out to try make a small sleep loop until
disklabel can return the label instead of
ioctl DIOCGDINFO: Input/output error
but it seems like disklabel does not really differentiate
between failures.
$ sudo disklabel sd2
disklabel: ioctl DIOCGDINFO: Input/output error
tyin:~$ echo $?
4
$ sudo disklabel sd3
disklabel: /dev/rsd3c: Device not configured
$ echo $?
4
also, i could not find the return codes in the disklabel
man page. is there a way to differentiate between the
error situations? i dont want to loop forever...
Makes sense to me.
Index: disklabel.c
===
RCS file: /cvs/src/sbin/disklabel/disklabel.c,v
retrieving revision 1.185
diff -u -p -u -r1.185 disklabel.c
--- disklabel.c 6 Apr 2012 18:20:35 - 1.185
+++ disklabel.c 12 May 2012 19:34:50 -
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
f = opendev(dkname, (op == READ ? O_RDONLY : O_RDWR), OPENDEV_PART,
specname);
if (f 0)
- err(4, %s, specname);
+ err(3, %s, specname);
switch (op) {
case EDIT: