Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
afb-config: Simplify version print
[src/app-framework-binder.git]
/
src
/
afb-trace.c
diff --git
a/src/afb-trace.c
b/src/afb-trace.c
index
dd6e863
..
7d4c81e
100644
(file)
--- a/
src/afb-trace.c
+++ b/
src/afb-trace.c
@@
-169,6
+169,7
@@
static int get_flag(const char *name, struct flag flags[], int count)
/* timestamp */
static struct json_object *timestamp(const struct afb_hookid *hookid)
{
/* timestamp */
static struct json_object *timestamp(const struct afb_hookid *hookid)
{
+#if JSON_C_MAJOR_VERSION > 0 || JSON_C_MINOR_VERSION >= 12
char ts[50];
snprintf(ts, sizeof ts, "%llu.%06lu",
char ts[50];
snprintf(ts, sizeof ts, "%llu.%06lu",
@@
-176,9
+177,9
@@
static struct json_object *timestamp(const struct afb_hookid *hookid)
(long unsigned)((hookid->time.tv_nsec + 500) / 1000));
return json_object_new_double_s(0.0f, ts); /* the real value isn't used */
(long unsigned)((hookid->time.tv_nsec + 500) / 1000));
return json_object_new_double_s(0.0f, ts); /* the real value isn't used */
-#
if 0
- return json_object_new_
string(ts);
- return json_object_new_double_s(0f, ts); /* the real value isn't used */
+#
else
+ return json_object_new_
double((double)hookid->time.tv_sec +
+ (double)hookid->time.tv_nsec * .000000001);
#endif
}
#endif
}
@@
-687,10
+688,12
@@
static void hook_api_rootdir_get_fd(void *closure, const struct afb_hookid *hook
{
char path[PATH_MAX], proc[100];
const char *key, *val;
{
char path[PATH_MAX], proc[100];
const char *key, *val;
+ ssize_t s;
if (result >= 0) {
snprintf(proc, sizeof proc, "/proc/self/fd/%d", result);
if (result >= 0) {
snprintf(proc, sizeof proc, "/proc/self/fd/%d", result);
- readlink(proc, path, sizeof path);
+ s = readlink(proc, path, sizeof path);
+ path[s < 0 ? 0 : s >= sizeof path ? sizeof path - 1 : s] = 0;
key = "path";
val = path;
} else {
key = "path";
val = path;
} else {
@@
-705,10
+708,12
@@
static void hook_api_rootdir_open_locale(void *closure, const struct afb_hookid
{
char path[PATH_MAX], proc[100];
const char *key, *val;
{
char path[PATH_MAX], proc[100];
const char *key, *val;
+ ssize_t s;
if (result >= 0) {
snprintf(proc, sizeof proc, "/proc/self/fd/%d", result);
if (result >= 0) {
snprintf(proc, sizeof proc, "/proc/self/fd/%d", result);
- readlink(proc, path, sizeof path);
+ s = readlink(proc, path, sizeof path);
+ path[s < 0 ? 0 : s >= sizeof path ? sizeof path - 1 : s] = 0;
key = "path";
val = path;
} else {
key = "path";
val = path;
} else {
@@
-1021,7
+1026,7
@@
static void hook_session(void *closure, const struct afb_hookid *hookid, struct
va_start(ap, format);
emit(closure, hookid, "session", "{ss ss}", format, ap,
va_start(ap, format);
emit(closure, hookid, "session", "{ss ss}", format, ap,
- "uuid",
session
,
+ "uuid",
afb_session_uuid(session)
,
"action", action);
va_end(ap);
}
"action", action);
va_end(ap);
}
@@
-1595,7
+1600,7
@@
static void add(void *closure, struct json_object *object)
wrap_json_optarray_for_all(event, add_evt_flags, &desc);
if (session)
wrap_json_optarray_for_all(event, add_evt_flags, &desc);
if (session)
- wrap_json_optarray_for_all(
event
, add_session_flags, &desc);
+ wrap_json_optarray_for_all(
session
, add_session_flags, &desc);
if (global)
wrap_json_optarray_for_all(global, add_global_flags, &desc);
if (global)
wrap_json_optarray_for_all(global, add_global_flags, &desc);