vfork always fail problem

Huang Bambo bambo.huang@gmail.com
Fri May 14 07:38:00 GMT 2010


I truly find the problem.
The path to the executable have Chinese character.
My windows's default language is gbk.
If I use utf-8 encoding for the shell, fork fail. If i use gbk, everything
goes fine.
The following is the test .

[Bambo@bambo-notebook ARM9]$ pwd
/cygdrive/d/个人研发/ARM9
                  ^^^^^^^^^^ Chinese directory name

[Bambo@bambo-notebook ARM9]$ export LANG=en_US.UTF-8
[Bambo@bambo-notebook ARM9]$ ./tvfork.exe
      3 [main] tvfork 4900 fork: child -1 - CreateProcessW failed, errno 2
vfork failed.: No such file or directory
[Bambo@bambo-notebook ARM9]$ export LANG=en_US.GBK
[Bambo@bambo-notebook ARM9]$ ./tvfork.exe
I'm parentI'm chield.


2010/5/14 Huang Bambo <bambo.huang@gmail.com>:
> Finally I test and get another result.
> I run the test program at
> /home/Bambo/test/t1/
> but /home/Bambo/test is a symbolic link to another directory.
> Maybe it's the problem that the system handle symbolic
>
> 2010/5/14 Huang Bambo <bambo.huang@gmail.com>:
>> [Bambo@bambo-notebook 4.4.4]$ cat tvfork.c
>> #include <sys/types.h>
>> #include <unistd.h>
>> #include <stdio.h>
>>
>> int main(void)
>> {
>>        pid_t pid = vfork();
>>        if ( pid > 0 )
>>        {
>>                printf("I'm chield.\n");
>>                _exit(0);
>>        }
>>        else if ( pid == 0 )
>>        {
>>                printf("I'm parent");
>>        }
>>        else
>>        {
>>                perror("vfork failed.");
>>        }
>> }
>> [Bambo@bambo-notebook 4.4.4]$ make tvfork
>> cc     tvfork.c   -o tvfork
>> [Bambo@bambo-notebook 4.4.4]$ ./tvfork.exe
>>      4 [main] tvfork 4136 fork: child -1 - CreateProcessW failed, errno 2
>> vfork failed.: No such file or directory
>> [Bambo@bambo-notebook 4.4.4]$ ./tvfork
>>      3 [main] tvfork 2956 fork: child -1 - CreateProcessW failed, errno 2
>> vfork failed.: No such file or directory
>>
>> I think maybe the wrong parameters were sent while calling CreateProcessW.
>>
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list