Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#define _POSIX_C_SOURCE 200809L | ||
#define _GNU_SOURCE | ||
|
||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <sys/time.h> | ||
#include <fcntl.h> | ||
#include <stdio.h> | ||
#include <errno.h> | ||
|
||
// NOTE: futimesat is obsolete (in favor of utimesat), but we should | ||
// still support any programs that might use it. | ||
|
||
int main() { | ||
int subd = openat(AT_FDCWD, "tmp/subdir1", O_RDONLY | O_DIRECTORY); | ||
struct timeval *ts = NULL; | ||
|
||
// the following should all fail, but should also not cause a crash | ||
// that would prevent the following utimensat from being traced. | ||
futimesat(subd, "foo_symlink_typo", ts); | ||
// The following is a way to silence a warning on using a null | ||
// pointer here. We are intentionally giving a bad value to ensure | ||
// it doesn't screw up bigbro. | ||
char *mynull = ((char *)5) - 5; | ||
futimesat(subd, mynull, ts); | ||
futimesat(subd, "", ts); | ||
|
||
int retval = futimesat(subd, "foo_symlink", ts); | ||
if (retval < 0) { | ||
perror("trouble"); | ||
} | ||
printf("retval was %d\n", retval); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import re | ||
|
||
import tests.helper as th | ||
|
||
def passes(out, err): | ||
return all( | ||
[th.reads(err, '/tests/futimesat.test'), | ||
th.writes(err, '/tmp/foo'), | ||
th.count_writes(err, 1), | ||
th.count_readdir(err, 0), | ||
]) | ||
|
||
needs_symlinks = False | ||
skip_windows = True |