Skip to content

Commit d36312f

Browse files
committed
Do not check for MiNT cookie when setting the rootdir
MagiC also has a U:\ drive
1 parent fba33c9 commit d36312f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

mintlib/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,11 @@ __libc_main (long _argc, char **_argv, char **_envp)
141141
else if (_rootdir < 'a' || _rootdir > 'z')
142142
_rootdir = 0;
143143

144-
/* if we're running under MiNT, and the current drive is U:, then this
144+
/* if we're running under MiNT, and the drive U: exists, then this
145145
* must be our preferred drive
146146
*/
147-
if (!_rootdir && __mint >= 9) {
148-
if (Dgetdrv() == 'U'-'A')
149-
_rootdir = 'u';
147+
if (!_rootdir && (Drvmap() & (1L << ('U'-'A')))) {
148+
_rootdir = 'u';
150149
}
151150

152151
/* If running under some recent MiNT there is no reason to convert

unix/open.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,28 @@ failsafe_Fopen (const char* name, int flags)
5454
}
5555

5656
int
57-
__open_v (const char *_filename, int iomode, va_list argp)
57+
__open_v (const char *filename, int iomode, va_list argp)
5858
{
5959
int rv;
6060
int modemask; /* which bits get passed to the OS? */
6161
char filenamebuf[PATH_MAX];
6262
long fcbuf; /* a temporary buffer for Fcntl */
6363
struct stat sb;
6464
unsigned int pmode = 0;
65-
char *filename = (char *) _filename;
6665

67-
if (!_filename) {
66+
if (!filename) {
6867
__set_errno (EFAULT);
6968
return -1;
7069
}
7170

72-
if (*_filename == '\0') {
71+
if (*filename == '\0') {
7372
__set_errno (ENOENT);
7473
return -1;
7574
}
7675

7776
if (!__libc_unix_names) {
77+
_unx2dos(filename, filenamebuf, sizeof (filenamebuf));
7878
filename = filenamebuf;
79-
_unx2dos(_filename, filename, sizeof (filenamebuf));
8079
}
8180

8281
if (iomode & O_CREAT)

0 commit comments

Comments
 (0)