Skip to content

Commit

Permalink
Merge pull request #1312 from trapexit/preload-tmpfile
Browse files Browse the repository at this point in the history
Special case O_TMPFILE in preload
  • Loading branch information
trapexit authored Feb 29, 2024
2 parents 19ee44a + 78050ed commit 42d0b57
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/preload.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ open(const char *pathname_,
LOAD_FUNC(open);

mode = 0;
if(flags_ & O_CREAT)
if(flags_ & (O_CREAT|O_TMPFILE))
{
va_list args;
va_start(args,flags_);
Expand All @@ -119,7 +119,7 @@ open(const char *pathname_,
if(fd == -1)
return -1;

if(flags_ & (O_DIRECTORY|O_PATH))
if(flags_ & (O_DIRECTORY|O_PATH|O_TMPFILE))
return fd;
rv = fstat(fd,&st);
if(rv == -1)
Expand Down Expand Up @@ -155,7 +155,7 @@ open64(const char *pathname_,
LOAD_FUNC(open64);

mode = 0;
if(flags_ & O_CREAT)
if(flags_ & (O_CREAT|O_TMPFILE))
{
va_list args;
va_start(args,flags_);
Expand All @@ -167,7 +167,7 @@ open64(const char *pathname_,
if(fd == -1)
return -1;

if(flags_ & (O_DIRECTORY|O_PATH))
if(flags_ & (O_DIRECTORY|O_PATH|O_TMPFILE))
return fd;
rv = fstat(fd,&st);
if(rv == -1)
Expand Down Expand Up @@ -204,7 +204,7 @@ openat(int dirfd_,
LOAD_FUNC(openat);

mode = 0;
if(flags_ & O_CREAT)
if(flags_ & (O_CREAT|O_TMPFILE))
{
va_list args;
va_start(args,flags_);
Expand All @@ -216,7 +216,7 @@ openat(int dirfd_,
if(fd == -1)
return -1;

if(flags_ & (O_DIRECTORY|O_PATH))
if(flags_ & (O_DIRECTORY|O_PATH|O_TMPFILE))
return fd;
rv = fstat(fd,&st);
if(rv == -1)
Expand Down Expand Up @@ -253,7 +253,7 @@ openat64(int dirfd_,
LOAD_FUNC(openat64);

mode = 0;
if(flags_ & O_CREAT)
if(flags_ & (O_CREAT|O_TMPFILE))
{
va_list args;
va_start(args,flags_);
Expand All @@ -265,7 +265,7 @@ openat64(int dirfd_,
if(fd == -1)
return -1;

if(flags_ & (O_DIRECTORY|O_PATH))
if(flags_ & (O_DIRECTORY|O_PATH|O_TMPFILE))
return fd;
rv = fstat(fd,&st);
if(rv == -1)
Expand Down

0 comments on commit 42d0b57

Please sign in to comment.