chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util: generalize is_localhost() and use it everywhere where applicable
[elogind.git]
/
src
/
shared
/
util.h
diff --git
a/src/shared/util.h
b/src/shared/util.h
index 5a2f10387e2a063b8217b185b5d3b0b4c3857df5..6d3791be7f096a8748c5540c2a6dfed3f2507f00 100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-523,6
+523,8
@@
int terminal_vhangup(const char *name);
int vt_disallocate(const char *name);
int symlink_atomic(const char *from, const char *to);
int vt_disallocate(const char *name);
int symlink_atomic(const char *from, const char *to);
+int mknod_atomic(const char *path, mode_t mode, dev_t dev);
+int mkfifo_atomic(const char *path, mode_t mode);
int fchmod_umask(int fd, mode_t mode);
int fchmod_umask(int fd, mode_t mode);
@@
-543,7
+545,6
@@
int glob_extend(char ***strv, const char *path);
int dirent_ensure_type(DIR *d, struct dirent *de);
int dirent_ensure_type(DIR *d, struct dirent *de);
-int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);
char *strjoin(const char *x, ...) _sentinel_;
int get_files_in_directory(const char *path, char ***list);
char *strjoin(const char *x, ...) _sentinel_;
@@
-672,6
+673,13
@@
_malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b)
return malloc(a * b);
}
return malloc(a * b);
}
+_alloc_(2, 3) static inline void *realloc_multiply(void *p, size_t a, size_t b) {
+ if (_unlikely_(b != 0 && a > ((size_t) -1) / b))
+ return NULL;
+
+ return realloc(p, a * b);
+}
+
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_t b) {
if (_unlikely_(b != 0 && a > ((size_t) -1) / b))
return NULL;
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_t b) {
if (_unlikely_(b != 0 && a > ((size_t) -1) / b))
return NULL;
@@
-951,3
+959,5
@@
int fflush_and_check(FILE *f);
char *tempfn_xxxxxx(const char *p);
char *tempfn_random(const char *p);
char *tempfn_xxxxxx(const char *p);
char *tempfn_random(const char *p);
+
+bool is_localhost(const char *hostname);