mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-25 02:29:49 +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)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
if (access("/dev/.devfsd", F_OK)) {
|
||||
if (access("/dev/.devfsd", F_OK) < 0) {
|
||||
PrefsAddString("floppy", "/dev/fd0u1440");
|
||||
PrefsAddString("floppy", "/dev/fd1u1440");
|
||||
} else {
|
||||
@ -130,10 +130,9 @@ void SysAddFloppyPrefs(void)
|
||||
struct dirent *floppy_dev;
|
||||
while ((floppy_dev = readdir(fd_dir)) != 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);
|
||||
PrefsAddString("floppy", fd_dev);
|
||||
delete[] fd_dev;
|
||||
}
|
||||
}
|
||||
closedir(fd_dir);
|
||||
@ -193,7 +192,7 @@ void SysAddCDROMPrefs(void)
|
||||
return;
|
||||
|
||||
#if defined(__linux__)
|
||||
if (access("/dev/.devfsd", F_OK))
|
||||
if (access("/dev/.devfsd", F_OK) < 0)
|
||||
PrefsAddString("cdrom", "/dev/cdrom");
|
||||
else {
|
||||
DIR *cd_dir = opendir("/dev/cdroms");
|
||||
@ -201,10 +200,9 @@ void SysAddCDROMPrefs(void)
|
||||
struct dirent *cdrom_dev;
|
||||
while ((cdrom_dev = readdir(cd_dir)) != NULL) {
|
||||
if (strcmp(cdrom_dev->d_name, ".") != 0 && strcmp(cdrom_dev->d_name, "..") != 0) {
|
||||
char *cd_dev = new char[20];
|
||||
strcpy(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name);
|
||||
char cd_dev[20];
|
||||
sprintf(cd_dev, "/dev/cdroms/%s", cdrom_dev->d_name);
|
||||
PrefsAddString("cdrom", cd_dev);
|
||||
delete[] cd_dev;
|
||||
}
|
||||
}
|
||||
closedir(cd_dir);
|
||||
@ -225,7 +223,7 @@ void SysAddCDROMPrefs(void)
|
||||
void SysAddSerialPrefs(void)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
if (access("/dev/.devfsd", F_OK)) {
|
||||
if (access("/dev/.devfsd", F_OK) < 0) {
|
||||
PrefsAddString("seriala", "/dev/ttyS0");
|
||||
PrefsAddString("serialb", "/dev/ttyS1");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user