repo.or.cz
/
AROS.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
bump copyright date on affected files and version
[AROS.git]
/
arch
/
all-hosted
/
bootstrap
/
log.c
blob
369d8ae63e3a6b289c6d94402647aedf65cb63bd
1
#include <fcntl.h>
2
#include <unistd.h>
3
4
#include
"log.h"
5
6
int
SetLog
(
const char
*
c
)
7
{
8
/*
9
* Redirect stderr on filedescriptor level.
10
* Redirecting on streams level does not work with Android's Bionic
11
*/
12
int
fd
=
open
(
c
,
O_WRONLY
|
O_CREAT
|
O_APPEND
,
0644
);
13
14
if
(
fd
== -
1
)
15
return
-
1
;
16
17
if
(
dup2
(
fd
,
STDERR_FILENO
) == -
1
)
18
{
19
close
(
fd
);
20
return
-
1
;
21
}
22
23
return
0
;
24
}