chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
socket: add option for SO_PASSEC
[elogind.git]
/
src
/
util.c
diff --git
a/src/util.c
b/src/util.c
index e9869ea4fad3bfd3695d41a6de7059db6deedfed..3a855c1be48e5f97e9f8bc6d476cc09a7b5d5aea 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-892,7
+892,7
@@
int load_env_file(
char ***rl) {
FILE *f;
char ***rl) {
FILE *f;
- char **m =
0
;
+ char **m =
NULL
;
int r;
assert(fname);
int r;
assert(fname);
@@
-1833,7
+1833,8
@@
char *cunescape_length(const char *s, size_t length) {
/* Undoes C style string escaping */
/* Undoes C style string escaping */
- if (!(r = new(char, length+1)))
+ r = new(char, length+1);
+ if (!r)
return r;
for (f = s, t = r; f < s + length; f++) {
return r;
for (f = s, t = r; f < s + length; f++) {
@@
-1887,8
+1888,10
@@
char *cunescape_length(const char *s, size_t length) {
/* hexadecimal encoding */
int a, b;
/* hexadecimal encoding */
int a, b;
- if ((a = unhexchar(f[1])) < 0 ||
- (b = unhexchar(f[2])) < 0) {
+ a = unhexchar(f[1]);
+ b = unhexchar(f[2]);
+
+ if (a < 0 || b < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = 'x';
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = 'x';
@@
-1911,9
+1914,11
@@
char *cunescape_length(const char *s, size_t length) {
/* octal encoding */
int a, b, c;
/* octal encoding */
int a, b, c;
- if ((a = unoctchar(f[0])) < 0 ||
- (b = unoctchar(f[1])) < 0 ||
- (c = unoctchar(f[2])) < 0) {
+ a = unoctchar(f[0]);
+ b = unoctchar(f[1]);
+ c = unoctchar(f[2]);
+
+ if (a < 0 || b < 0 || c < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = f[0];
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = f[0];
@@
-4177,7
+4182,7
@@
int wait_for_terminate_and_warn(const char *name, pid_t pid) {
}
}
-void freeze(void) {
+
_noreturn_
void freeze(void) {
/* Make sure nobody waits for us on a socket anymore */
close_all_fds(NULL, 0);
/* Make sure nobody waits for us on a socket anymore */
close_all_fds(NULL, 0);