add a few checks
This commit is contained in:
parent
b13769e1fc
commit
575ff1f2b9
12
MD_Init.c
12
MD_Init.c
@ -183,12 +183,12 @@ void md_exit(int exitcode) {
|
|||||||
exit(exitcode);
|
exit(exitcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int md_init(const char *dropfile, int socket) {
|
void md_init(const char *dropfile, int socket) {
|
||||||
char *filename = strrchr(dropfile, PATH_SEP);
|
char *filename = strrchr(dropfile, PATH_SEP);
|
||||||
#if !defined(WIN32) && !defined(_MSC_VER)
|
#if !defined(WIN32) && !defined(_MSC_VER)
|
||||||
struct termios ttystate;
|
struct termios ttystate;
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret = -1;
|
||||||
|
|
||||||
mdcontrol.socket = socket;
|
mdcontrol.socket = socket;
|
||||||
|
|
||||||
@ -202,6 +202,14 @@ int md_init(const char *dropfile, int socket) {
|
|||||||
ret = read_doorsys(dropfile);
|
ret = read_doorsys(dropfile);
|
||||||
} else if (strcasecmp(filename, "door32.sys") == 0) {
|
} else if (strcasecmp(filename, "door32.sys") == 0) {
|
||||||
ret = read_door32(dropfile);
|
ret = read_door32(dropfile);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Unsupported dropfile: %s\n", filename);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == -1) {
|
||||||
|
fprintf(stderr, "Unable to open dropfile: %s\n", dropfile);
|
||||||
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mdcontrol.socket == -1) {
|
if (mdcontrol.socket == -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user