mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
Fix devfs loop device support
This commit is contained in:
parent
b0cc0a6ca8
commit
c7a3fb96d0
@ -270,6 +270,7 @@ extern const char * const can_not_create_raw_socket;
|
|||||||
# define SC_1 "/dev/tts/1"
|
# define SC_1 "/dev/tts/1"
|
||||||
# define VC_FORMAT "/dev/vc/%d"
|
# define VC_FORMAT "/dev/vc/%d"
|
||||||
# define SC_FORMAT "/dev/tts/%d"
|
# define SC_FORMAT "/dev/tts/%d"
|
||||||
|
# define LOOP_FORMAT "/dev/loop/%d"
|
||||||
#else
|
#else
|
||||||
# define CURRENT_VC "/dev/tty0"
|
# define CURRENT_VC "/dev/tty0"
|
||||||
# define VC_1 "/dev/tty1"
|
# define VC_1 "/dev/tty1"
|
||||||
@ -281,6 +282,7 @@ extern const char * const can_not_create_raw_socket;
|
|||||||
# define SC_1 "/dev/ttyS1"
|
# define SC_1 "/dev/ttyS1"
|
||||||
# define VC_FORMAT "/dev/tty%d"
|
# define VC_FORMAT "/dev/tty%d"
|
||||||
# define SC_FORMAT "/dev/ttyS%d"
|
# define SC_FORMAT "/dev/ttyS%d"
|
||||||
|
# define LOOP_FORMAT "/dev/loop%d"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following devices are the same on devfs and non-devfs systems. */
|
/* The following devices are the same on devfs and non-devfs systems. */
|
||||||
|
@ -95,7 +95,7 @@ extern char *find_unused_loop_device(void)
|
|||||||
struct loop_info loopinfo;
|
struct loop_info loopinfo;
|
||||||
|
|
||||||
for (i = 0; i <= 7; i++) {
|
for (i = 0; i <= 7; i++) {
|
||||||
sprintf(dev, "/dev/loop%d", i);
|
sprintf(dev, LOOP_FORMAT, i);
|
||||||
if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
|
if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
|
||||||
if ((fd = open(dev, O_RDONLY)) >= 0) {
|
if ((fd = open(dev, O_RDONLY)) >= 0) {
|
||||||
if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) {
|
if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user