bool dirent_is_file(const struct dirent *de) _pure_;
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_;
-bool ignore_file(const char *filename) _pure_;
+bool hidden_file(const char *filename) _pure_;
bool chars_intersect(const char *a, const char *b) _pure_;
on_error; \
} \
break; \
- } else if (ignore_file((de)->d_name)) \
+ } else if (hidden_file((de)->d_name)) \
continue; \
else
+#define FOREACH_DIRENT_ALL(de, d, on_error) \
+ for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \
+ if (!de) { \
+ if (errno > 0) { \
+ on_error; \
+ } \
+ break; \
+ } else
+
static inline void *mempset(void *s, int c, size_t n) {
memset(s, c, n);
return (uint8_t*)s + n;
(void *) memset(_new_, 0, _len_); \
})
+/* It's not clear what alignment glibc/gcc alloca() guarantee, hence provide a guaranteed safe version */
#define alloca_align(size, align) \
({ \
void *_ptr_; \
int tempfn_xxxxxx(const char *p, char **ret);
int tempfn_random(const char *p, char **ret);
+int tempfn_random_child(const char *p, char **ret);
bool is_localhost(const char *hostname);
for ((e) = (struct inotify_event*) (buffer); \
(uint8_t*) (e) < (uint8_t*) (buffer) + (sz); \
(e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len))
+
+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)