chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Be more careful when checking for empty files
[elogind.git]
/
src
/
shared
/
util.h
diff --git
a/src/shared/util.h
b/src/shared/util.h
index e23069c016837ea1cde76d01dbd60cf3d0c8e382..d9d525e8a51215eedcb815d5f6c8de924602faae 100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-93,6
+93,12
@@
#define COMMENTS "#;"
#define GLOB_CHARS "*?["
#define COMMENTS "#;"
#define GLOB_CHARS "*?["
+/* What characters are special in the shell? */
+/* must be escaped outside and inside double-quotes */
+#define SHELL_NEED_ESCAPE "\"\\`$"
+/* can be escaped or double-quoted */
+#define SHELL_NEED_QUOTES SHELL_NEED_ESCAPE GLOB_CHARS "'()<>|&;"
+
#define FORMAT_BYTES_MAX 8
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
#define FORMAT_BYTES_MAX 8
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
@@
-382,7
+388,8
@@
bool fstype_is_network(const char *fstype);
int chvt(int vt);
int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
int chvt(int vt);
int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
-int ask(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
+int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
+int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
@@
-492,6
+499,7
@@
noreturn void freeze(void);
bool null_or_empty(struct stat *st) _pure_;
int null_or_empty_path(const char *fn);
bool null_or_empty(struct stat *st) _pure_;
int null_or_empty_path(const char *fn);
+int null_or_empty_fd(int fd);
DIR *xopendirat(int dirfd, const char *name, int flags);
DIR *xopendirat(int dirfd, const char *name, int flags);
@@
-692,7
+700,7
@@
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_
bool filename_is_safe(const char *p) _pure_;
bool path_is_safe(const char *p) _pure_;
bool string_is_safe(const char *p) _pure_;
bool filename_is_safe(const char *p) _pure_;
bool path_is_safe(const char *p) _pure_;
bool string_is_safe(const char *p) _pure_;
-bool string_has_cc(const char *p) _pure_;
+bool string_has_cc(const char *p
, const char *ok
) _pure_;
/**
* Check if a string contains any glob patterns.
/**
* Check if a string contains any glob patterns.
@@
-963,3
+971,5
@@
char *tempfn_xxxxxx(const char *p);
char *tempfn_random(const char *p);
bool is_localhost(const char *hostname);
char *tempfn_random(const char *p);
bool is_localhost(const char *hostname);
+
+int take_password_lock(const char *root);