--- mc-4.5.42/src/cons.saver.c Mon Dec 6 18:50:02 1999 +++ mc-4.5.42/src/cons.saver.c.z33d Sun Nov 12 17:20:48 2000 @@ -116,12 +116,15 @@ if (fd == -1) return -1; - if (fstat (fd, &stat_buf) == -1) + if (fstat (fd, &stat_buf) == -1){ + close(fd); return -1; + } /* Must be character device */ if (!S_ISCHR (stat_buf.st_mode)){ *msg = "Not a character device"; + close(fd); return -1; } @@ -132,17 +135,20 @@ /* Second time: must be console */ if ((stat_buf.st_rdev & 0xff00) != 0x0400){ *msg = "Not a console"; + close(fd); return -1; } if ((stat_buf.st_rdev & 0x00ff) > 63){ *msg = "Minor device number too big"; + close(fd); return -1; } /* Must be owned by the user */ if (stat_buf.st_uid != getuid ()){ *msg = "Not a owner"; + close(fd); return -1; } }