chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service/systemctl: don't consider LSB exit codes 5 and 6 as failure, and decode exit...
[elogind.git]
/
src
/
util.c
diff --git
a/src/util.c
b/src/util.c
index c4ff5aa575d4ea45d6b69cb42c1560354fef7acc..7903ca07b99fe64d493948f579eb9e34f3adbd31 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-1,4
+1,4
@@
-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8
; indent-tabs-mode: nil
-*-*/
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-48,6
+48,7
@@
#include <pwd.h>
#include <netinet/ip.h>
#include <linux/kd.h>
#include <pwd.h>
#include <netinet/ip.h>
#include <linux/kd.h>
+#include <dlfcn.h>
#include "macro.h"
#include "util.h"
#include "macro.h"
#include "util.h"
@@
-56,6
+57,7
@@
#include "log.h"
#include "strv.h"
#include "label.h"
#include "log.h"
#include "strv.h"
#include "label.h"
+#include "exit-status.h"
bool streq_ptr(const char *a, const char *b) {
bool streq_ptr(const char *a, const char *b) {
@@
-2397,6
+2399,16
@@
bool is_clean_exit(int code, int status) {
return false;
}
return false;
}
+bool is_clean_exit_lsb(int code, int status) {
+
+ if (is_clean_exit(code, status))
+ return true;
+
+ return
+ code == CLD_EXITED &&
+ (status == EXIT_NOTINSTALLED || status == EXIT_NOTCONFIGURED);
+}
+
bool is_device_path(const char *path) {
/* Returns true on paths that refer to a device, either in
bool is_device_path(const char *path) {
/* Returns true on paths that refer to a device, either in
@@
-2530,11
+2542,12
@@
char* getlogname_malloc(void) {
int getttyname_malloc(char **r) {
char path[PATH_MAX], *p, *c;
int getttyname_malloc(char **r) {
char path[PATH_MAX], *p, *c;
+ int k;
assert(r);
assert(r);
- if (
ttyname_r(STDIN_FILENO, path, sizeof(path)) <
0)
- return -
errno
;
+ if (
(k = ttyname_r(STDIN_FILENO, path, sizeof(path))) !=
0)
+ return -
k
;
char_array_0(path);
char_array_0(path);
@@
-2979,6
+2992,18
@@
char *ellipsize(const char *s, unsigned length, unsigned percent) {
return r;
}
return r;
}
+int touch(const char *path) {
+ int fd;
+
+ assert(path);
+
+ if ((fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666)) < 0)
+ return -errno;
+
+ close_nointr_nofail(fd);
+ return 0;
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",