Skip to content

Commit

Permalink
Move O_SYMLINK and O_EVTONLY defines from compat header to place where
Browse files Browse the repository at this point in the history
open called as O_RDONLY and O_NOFOLLOW are not 1:1 replacements.
Suggested by Dmitry Matveev
  • Loading branch information
wulf7 committed Apr 27, 2015
1 parent dd0fb64 commit fee8152
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 0 additions & 7 deletions compat.h
Expand Up @@ -44,13 +44,6 @@
#include <fcntl.h>
#include <pthread.h>

#ifndef O_SYMLINK
#define O_SYMLINK O_NOFOLLOW
#endif
#ifndef O_EVTONLY
#define O_EVTONLY O_RDONLY
#endif

#ifndef DTTOIF
#define DTTOIF(dirtype) ((dirtype) << 12)
#endif
Expand Down
13 changes: 11 additions & 2 deletions watch.c
Expand Up @@ -87,12 +87,21 @@ watch_open (int dirfd, const char *path, uint32_t flags)
{
assert (path != NULL);

int openflags = O_EVTONLY | O_NONBLOCK;
int openflags = O_NONBLOCK;
#ifdef O_EVTONLY
openflags |= O_EVTONLY;
#else
openflags |= O_RDONLY;
#endif
#ifdef O_CLOEXEC
openflags |= O_CLOEXEC;
openflags |= O_CLOEXEC;
#endif
if (flags & IN_DONT_FOLLOW) {
#ifdef O_SYMLINK
openflags |= O_SYMLINK;
#else
openflags |= O_NOFOLLOW;
#endif
}
#ifdef O_DIRECTORY
if (flags & IN_ONLYDIR) {
Expand Down

0 comments on commit fee8152

Please sign in to comment.