fd-util: Move O_ACCMODE_STRICT to fd-util.h
We're still discussing whether we want to remove this or not, but regardless of whether we end up removing it or not, it's something we add ourselves and as such should not live in our headers that override glibc headers, so let's move it to fd-util.h.
This commit is contained in:
@@ -44,6 +44,12 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* On musl, O_ACCMODE is defined as (03|O_SEARCH), unlike glibc which defines it as
|
||||
* (O_RDONLY|O_WRONLY|O_RDWR). Additionally, O_SEARCH is simply defined as O_PATH. This changes the behaviour
|
||||
* of O_ACCMODE in certain situations, which we don't want. This definition is copied from glibc and works
|
||||
* around the problems with musl's definition. */
|
||||
#define O_ACCMODE_STRICT (O_RDONLY|O_WRONLY|O_RDWR)
|
||||
|
||||
int close_nointr(int fd);
|
||||
int safe_close(int fd);
|
||||
void safe_close_pair(int p[static 2]);
|
||||
|
||||
@@ -17,9 +17,3 @@
|
||||
#ifndef AT_HANDLE_FID
|
||||
#define AT_HANDLE_FID AT_REMOVEDIR
|
||||
#endif
|
||||
|
||||
/* On musl, O_ACCMODE is defined as (03|O_SEARCH), unlike glibc which defines it as
|
||||
* (O_RDONLY|O_WRONLY|O_RDWR). Additionally, O_SEARCH is simply defined as O_PATH. This changes the behaviour
|
||||
* of O_ACCMODE in certain situations, which we don't want. This definition is copied from glibc and works
|
||||
* around the problems with musl's definition. */
|
||||
#define O_ACCMODE_STRICT (O_RDONLY|O_WRONLY|O_RDWR)
|
||||
|
||||
@@ -4694,6 +4694,11 @@ bool journal_file_rotate_suggested(JournalFile *f, usec_t max_file_usec, int log
|
||||
return false;
|
||||
}
|
||||
|
||||
bool journal_file_writable(JournalFile *f) {
|
||||
assert(f);
|
||||
return (f->open_flags & O_ACCMODE_STRICT) != O_RDONLY;
|
||||
}
|
||||
|
||||
static const char * const journal_object_type_table[] = {
|
||||
[OBJECT_UNUSED] = "unused",
|
||||
[OBJECT_DATA] = "data",
|
||||
|
||||
@@ -378,7 +378,4 @@ static inline uint32_t COMPRESSION_TO_HEADER_INCOMPATIBLE_FLAG(Compression c) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool journal_file_writable(JournalFile *f) {
|
||||
assert(f);
|
||||
return (f->open_flags & O_ACCMODE_STRICT) != O_RDONLY;
|
||||
}
|
||||
bool journal_file_writable(JournalFile *f);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "chattr-util.h"
|
||||
#include "copy.h"
|
||||
#include "errno-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "journal-authenticate.h"
|
||||
#include "journal-file-util.h"
|
||||
#include "log.h"
|
||||
|
||||
Reference in New Issue
Block a user