[LTP] What is wrong with this program ?

Viresh Kumar
2020-04-28T09:47:45Z

#include "tst_test.h"

static void run(void)
{
int fd;

fd = SAFE_OPEN("file", O_RDWR | O_CREAT);
SAFE_CLOSE(fd);
fd = SAFE_OPEN("file", O_RDWR | O_CREAT);
}

static struct tst_test test = {
.test_all = run,
.needs_tmpdir = 1,
};

It fails with:

safe_macros.c:230: BROK: foo.c:9: open(file,66,01) failed: EACCES (13)

if run as a normal user and passes with sudo.

--
viresh