mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 17:29:19 +00:00
- Clarified test of access() return value
- s/strcpy/sprintf/ for cd_dev concatenation - Statically allocate fd_dev[] and cd_dev[] Better testing is yet to be done
This commit is contained in:
parent
15ce8c14f9
commit
c9563ddb5c
@ -121,7 +121,7 @@ void SysMountFirstFloppy(void)
|
|||||||
void SysAddFloppyPrefs(void)
|
void SysAddFloppyPrefs(void)
|
||||||
{
|
{
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
if (access("/dev/.devfsd", F_OK)) {
|
if (access("/dev/.devfsd", F_OK) < 0) {
|
||||||
PrefsAddString("floppy", "/dev/fd0u1440");
|
PrefsAddString("floppy", "/dev/fd0u1440");
|
||||||
PrefsAddString("floppy", "/dev/fd1u1440");
|
PrefsAddString("floppy", "/dev/fd1u1440");
|
||||||
} else {
|
} else {
|
||||||
@ -130,10 +130,9 @@ void SysAddFloppyPrefs(void)
|
|||||||
struct dirent *floppy_dev;
|
struct dirent *floppy_dev;
|
||||||
while ((floppy_dev = readdir(fd_dir)) != NULL) {
|
while ((floppy_dev = readdir(fd_dir)) != NULL) {
|
||||||
if (strstr(floppy_dev->d_name, "u1440") != NULL) {
|
if (strstr(floppy_dev->d_name, "u1440") != NULL) {
|
||||||
char *fd_dev = new char[20];
|
char fd_dev[20];
|
||||||
sprintf(fd_dev, "/dev/floppy/%s", floppy_dev->d_name);
|
sprintf(fd_dev, "/dev/floppy/%s", floppy_dev->d_name);
|
||||||
PrefsAddString("floppy", fd_dev);
|
PrefsAddString("floppy", fd_dev);
|
||||||
delete[] fd_dev;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(fd_dir);
|
closedir(fd_dir);
|
||||||
@ -193,7 +192,7 @@ void SysAddCDROMPrefs(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
if (access("/dev/.devfsd", F_OK))
|
if (access("/dev/.devfsd", F_OK) < 0)
|
||||||
PrefsAddString("cdrom", "/dev/cdrom");
|
PrefsAddString("cdrom", "/dev/cdrom");
|
||||||
else {
|
else {
|
||||||
DIR *cd_dir = opendir("/dev/cdroms");
|
DIR *cd_dir = opendir("/dev/cdroms");
|
||||||
@ -201,10 +200,9 @@ void SysAddCDROMPrefs(void)
|
|||||||
struct dirent *cdrom_dev;
|
struct dirent *cdrom_dev;
|
||||||
while ((cdrom_dev = readdir(cd_dir)) != NULL) {
|
while ((cdrom_dev = readdir(cd_dir)) != NULL) {
|
||||||
if (strcmp(cdrom_dev->d_name, ".") != 0 && strcmp(cdrom_dev->d_name, "..") != 0) {
|
if (strcmp(cdrom_dev->d_name, ".") != 0 && strcmp(cdrom_dev->d_name, "..") != 0) {
|
||||||
char *cd_dev = new char[20];
|
char cd_dev[20];
|
||||||
strcpy(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name);
|
sprintf(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name);
|
||||||
PrefsAddString("cdrom", cd_dev);
|
PrefsAddString("cdrom", cd_dev);
|
||||||
delete[] cd_dev;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(cd_dir);
|
closedir(cd_dir);
|
||||||
@ -225,7 +223,7 @@ void SysAddCDROMPrefs(void)
|
|||||||
void SysAddSerialPrefs(void)
|
void SysAddSerialPrefs(void)
|
||||||
{
|
{
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
if (access("/dev/.devfsd", F_OK)) {
|
if (access("/dev/.devfsd", F_OK) < 0) {
|
||||||
PrefsAddString("seriala", "/dev/ttyS0");
|
PrefsAddString("seriala", "/dev/ttyS0");
|
||||||
PrefsAddString("serialb", "/dev/ttyS1");
|
PrefsAddString("serialb", "/dev/ttyS1");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user