chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't use 'long long' unless we have a really good reason to
[elogind.git]
/
src
/
util.c
diff --git
a/src/util.c
b/src/util.c
index 78d8d5d9c5d99fd1a91d72858fda6d17a09407fe..6fa9dec3a6532cf4de57ba8b554c1bda1de3680a 100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-446,12
+446,12
@@
int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
int r;
FILE *f;
char fn[132], line[256], *p;
int r;
FILE *f;
char fn[132], line[256], *p;
- long
long
unsigned ppid;
+ long unsigned ppid;
assert(pid >= 0);
assert(_ppid);
assert(pid >= 0);
assert(_ppid);
- assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%l
lu/stat", (unsigned long
long) pid) < (int) (sizeof(fn)-1));
+ assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%l
u/stat", (unsigned
long) pid) < (int) (sizeof(fn)-1));
fn[sizeof(fn)-1] = 0;
if (!(f = fopen(fn, "r")))
fn[sizeof(fn)-1] = 0;
if (!(f = fopen(fn, "r")))
@@
-476,11
+476,11
@@
int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
if (sscanf(p, " "
"%*c " /* state */
if (sscanf(p, " "
"%*c " /* state */
- "%l
l
u ", /* ppid */
+ "%lu ", /* ppid */
&ppid) != 1)
return -EIO;
&ppid) != 1)
return -EIO;
- if ((long
long
unsigned) (pid_t) ppid != ppid)
+ if ((long unsigned) (pid_t) ppid != ppid)
return -ERANGE;
*_ppid = (pid_t) ppid;
return -ERANGE;
*_ppid = (pid_t) ppid;
@@
-552,7
+552,7
@@
int get_process_name(pid_t pid, char **name) {
assert(pid >= 1);
assert(name);
assert(pid >= 1);
assert(name);
- if (asprintf(&p, "/proc/%l
lu/comm", (unsigned long
long) pid) < 0)
+ if (asprintf(&p, "/proc/%l
u/comm", (unsigned
long) pid) < 0)
return -ENOMEM;
r = read_one_line_file(p, name);
return -ENOMEM;
r = read_one_line_file(p, name);
@@
-1499,7
+1499,7
@@
char *format_timestamp(char *buf, size_t l, usec_t t) {
if (t <= 0)
return NULL;
if (t <= 0)
return NULL;
- sec = (time_t)
t / USEC_PER_SEC
;
+ sec = (time_t)
(t / USEC_PER_SEC)
;
if (strftime(buf, l, "%a, %d %b %Y %H:%M:%S %z", localtime_r(&sec, &tm)) <= 0)
return NULL;
if (strftime(buf, l, "%a, %d %b %Y %H:%M:%S %z", localtime_r(&sec, &tm)) <= 0)
return NULL;