blob: fb47c0569d00bbac4ce688b57827d37bd0481b90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*
* SPDX-License-Identifier: LGPL-2.1-only
*
* Test we can rename a file whilst holding an open fd which we fstat after renaming
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main()
{
struct stat buf;
int err;
int fd = open("test-rename-fstat1", O_RDONLY);
err = rename("test-rename-fstat1", "test-rename-fstat1");
if (err)
return err;
return fstat(fd, &buf);
}
|