﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
237	libc: _fullpath() changes current drive	dmik	bird	"I found that _fullpath() implicitly changes the current OS/2 drive letter under some circumstances. Here is a test case:

{{{
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>

#define TEST 2

#if TEST == 1
    // OK: this doesn't change current drive
    const char *path = ""CONFIG.SYS"";
#elif TEST == 2
    // FAIL: this changes current drive to C:
    const char *path = ""C:\\CONFIG.SYS"";
#elif TEST == 3
    // FAIL: this changes current drive to C: too
    const char *path = ""C:\\FAKEDIR\\CONFIG.SYS"";
#endif

int main ()
{
    char buf [260];

    printf (""current drive = %c\n"", _getdrive());

    int rc = _fullpath (buf, path, sizeof(buf));
    if (!rc)
        printf (""_fullpath (%s) = %s\n"", path, buf);
    else
        printf (""rc = %d, errno = %s\n"", rc, strerror(errno));

    printf (""current drive = %c\n"", _getdrive());

    return 0;
}
}}}

I find this side effect completely unexpected and error prone."	defect	closed	normal	libc-0.6.5	libc	0.6	normal	fixed		
