Unify handling of getcwd(3) failure and don't rely on buffer contents after failed call
This commit is contained in:
parent
d5db35b861
commit
ef5a250670
|
@ -735,7 +735,7 @@ ChimeraRequest *lastresort;
|
|||
if (getcwd( base_url + 5, sizeof(base_url) - 5 ) == NULL) {
|
||||
perror("getcwd failed");
|
||||
// Try using just the root of filesystem if we could not get cwd
|
||||
strcat( base_url, "/" ) ;
|
||||
strcpy( base_url + 5, "/" ) ;
|
||||
}
|
||||
strcat( base_url, "/" ) ;
|
||||
|
||||
|
|
|
@ -79,7 +79,8 @@ char **argv;
|
|||
strcpy( base_url, "file:" ) ;
|
||||
if (getcwd( base_url + 5, sizeof(base_url) - 5 ) == NULL) {
|
||||
perror("getcwd failed");
|
||||
return 1;
|
||||
// Try using just the root of filesystem if we could not get cwd
|
||||
strcpy( base_url + 5, "/");
|
||||
}
|
||||
strcat( base_url, "/" ) ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue