=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cdio/cdio.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/cdio/cdio.c 1998/07/09 20:10:26 1.11 --- src/usr.bin/cdio/cdio.c 1998/12/20 23:53:35 1.12 *************** *** 1,4 **** ! /* $OpenBSD: cdio.c,v 1.11 1998/07/09 20:10:26 csapuntz Exp $ */ /* * Compact Disc Control Utility by Serge V. Vakulenko . * Based on the non-X based CD player by Jean-Marc Zucconi and --- 1,4 ---- ! /* $OpenBSD: cdio.c,v 1.12 1998/12/20 23:53:35 millert Exp $ */ /* * Compact Disc Control Utility by Serge V. Vakulenko . * Based on the non-X based CD player by Jean-Marc Zucconi and *************** *** 1164,1182 **** char *dev; { char *realdev; if (fd > -1) return (1); ! fd = opendev(dev, O_RDONLY, OPENDEV_PART, &realdev); ! if (fd < 0) { ! if ((errno == ENXIO) || (errno == EIO)) { ! /* ENXIO has an overloaded meaning here. ! * The original "Device not configured" should ! * be interpreted as "No disc in drive %s". */ ! warnx ("No disc in drive %s.", realdev); ! return (0); } warn ("Can't open %s", realdev); return (0); } --- 1164,1193 ---- char *dev; { char *realdev; + int tries; if (fd > -1) return (1); ! for (tries = 0; fd < 0 && tries < 10; tries++) { ! fd = opendev(dev, O_RDONLY, OPENDEV_PART, &realdev); ! if (fd < 0) { ! if (errno == ENXIO) { ! /* ENXIO has an overloaded meaning here. ! * The original "Device not configured" should ! * be interpreted as "No disc in drive %s". */ ! warnx ("No disc in drive %s.", realdev); ! return (0); ! } else if (errno != EIO) { ! /* EIO may simply mean the device is not ready ! * yet which is common with CD changers. */ ! warn ("Can't open %s", realdev); ! return (0); ! } } + sleep (1); + } + if (fd < 0) { warn ("Can't open %s", realdev); return (0); }