chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
importd: add new bus calls for importing local tar and raw images
[elogind.git]
/
src
/
test
/
test-tmpfiles.c
diff --git
a/src/test/test-tmpfiles.c
b/src/test/test-tmpfiles.c
index f25a0dca525b96d30b75eb35e33a59200bf07921..90e49d454233b393be27cb95e144a4de8969face 100644
(file)
--- a/
src/test/test-tmpfiles.c
+++ b/
src/test/test-tmpfiles.c
@@
-19,8
+19,6
@@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
@@
-30,18
+28,18
@@
int main(int argc, char** argv) {
const char *p = argv[1] ?: "/tmp";
int main(int argc, char** argv) {
const char *p = argv[1] ?: "/tmp";
- char *pattern = str
append
a(p, "/systemd-test-XXXXXX");
+ char *pattern = str
join
a(p, "/systemd-test-XXXXXX");
_cleanup_close_ int fd, fd2;
_cleanup_free_ char *cmd, *cmd2;
_cleanup_close_ int fd, fd2;
_cleanup_free_ char *cmd, *cmd2;
- fd = open_tmpfile(p, O_RDWR);
- assert(fd >= 0);
+ fd = open_tmpfile(p, O_RDWR
|O_CLOEXEC
);
+ assert
_se
(fd >= 0);
assert_se(asprintf(&cmd, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd) > 0);
system(cmd);
assert_se(asprintf(&cmd, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd) > 0);
system(cmd);
- fd2 = mkostemp_safe(pattern, O_RDWR);
- assert(fd >= 0);
+ fd2 = mkostemp_safe(pattern, O_RDWR
|O_CLOEXEC
);
+ assert
_se
(fd >= 0);
assert_se(unlink(pattern) == 0);
assert_se(asprintf(&cmd2, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd2) > 0);
assert_se(unlink(pattern) == 0);
assert_se(asprintf(&cmd2, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd2) > 0);