HCoop
/
hcoop
/
debian
/
openafs.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Import Upstream version 1.8.5
[hcoop/debian/openafs.git]
/
src
/
tests
/
dup2-and-unlog.c
1
#ifdef HAVE_CONFIG_H
2
#include <config.h>
3
#endif
4
5
#include <sys/types.h>
6
#include <stdio.h>
7
#include <fcntl.h>
8
#include <unistd.h>
9
#include <err.h>
10
11
#include <afs/stds.h>
12
#include <afs/auth.h>
13
14
int
15
main
(
int
argc
,
char
**
argv
)
16
{
17
int
fd
;
18
19
20
fd
=
open
(
"foo"
,
O_RDWR
|
O_CREAT
,
0666
);
21
if
(
fd
<
0
)
22
err
(
1
,
"open"
);
23
24
dup2
(
fd
+
1
,
fd
);
25
26
if
(
write
(
fd
,
"foo
\n
"
,
4
) !=
4
)
27
errx
(
1
,
"write"
);
28
29
ktc_ForgetAllTokens
();
30
31
close
(
fd
);
32
close
(
fd
+
1
);
33
34
exit
(
0
);
35
}