diff options
author | ngie <ngie@FreeBSD.org> | 2015-04-11 03:18:14 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-04-11 03:18:14 +0000 |
commit | 78724b4a62f8eaa1a1a17cc1e9e29bae42508188 (patch) | |
tree | c8972dbd853f771c3e20057c6e4b51ae866f966b /tools | |
parent | 7f2176680016863a5439eec93ef66384706219b0 (diff) | |
download | FreeBSD-src-78724b4a62f8eaa1a1a17cc1e9e29bae42508188.zip FreeBSD-src-78724b4a62f8eaa1a1a17cc1e9e29bae42508188.tar.gz |
- Don't use /tmp because it's outside ATF's prescribed sandbox
- Replace a hardcoded PATH_MAX value with sizeof(path)
- Use path like an array, not a pointer, and always try to unlink it in cleanup
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/sockets/sendfile/sendfile.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/regression/sockets/sendfile/sendfile.c b/tools/regression/sockets/sendfile/sendfile.c index 73033d7..18ae9ad 100644 --- a/tools/regression/sockets/sendfile/sendfile.c +++ b/tools/regression/sockets/sendfile/sendfile.c @@ -452,8 +452,8 @@ run_parent(void) static void cleanup(void) { - if (*path != '\0') - unlink(path); + + unlink(path); } int @@ -461,12 +461,12 @@ main(int argc, char *argv[]) { int pagesize; - *path = '\0'; + path[0] = '\0'; pagesize = getpagesize(); if (argc == 1) { - snprintf(path, PATH_MAX, "/tmp/sendfile.XXXXXXXXXXXX"); + snprintf(path, sizeof(path), "sendfile.XXXXXXXXXXXX"); file_fd = mkstemp(path); if (file_fd == -1) FAIL_ERR("mkstemp"); |