repo.or.cz
/
git-darcs-import.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Follow upstream changes -- rest
[git-darcs-import.git]
/
src
/
umask.c
blob
dccfb7f7c96acafefbfe863546286439b6d92454
1
#include <sys/types.h>
2
#include <sys/stat.h>
3
#include <stdlib.h>
4
#include <errno.h>
5
#include
"umask.h"
6
7
int
8
set_umask
(
char
*
mask_string
)
9
{
10
#ifndef WIN32
11
int
rc
;
12
unsigned
mask
;
13
char
*
end
;
14
15
mask
=
strtoul
(
mask_string
, &
end
,
8
);
16
if
(!
end
|| *
end
!=
'\0'
) {
17
errno
=
EINVAL
;
18
return
-
1
;
19
}
20
21
rc
=
umask
(
mask
);
22
return
rc
;
23
#else
24
/* umask() has no useful meaning on win32. */
25
return
0
;
26
#endif
/* #ifndef WIN32 ... else ... */
27
}
28
29
int
30
reset_umask
(
int
old_mask
)
31
{
32
umask
(
old_mask
);
33
return
1
;
34
}