Check snprintf return value
This commit is contained in:
parent
28fa152169
commit
d4246c1c24
9
ovni.c
9
ovni.c
@ -75,7 +75,11 @@ create_trace_stream()
|
||||
fprintf(stderr, "create thread stream tid=%d gettid=%d rproc.proc=%d rproc.ready=%d\n",
|
||||
rthread.tid, gettid(), rproc.proc, rproc.ready);
|
||||
|
||||
snprintf(path, PATH_MAX, "%s/thread.%d", rproc.dir, rthread.tid);
|
||||
if(snprintf(path, PATH_MAX, "%s/thread.%d", rproc.dir, rthread.tid)
|
||||
>= PATH_MAX)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
||||
//rthread.streamfd = open(path, O_WRONLY | O_CREAT | O_DSYNC, 0644);
|
||||
rthread.streamfd = open(path, O_WRONLY | O_CREAT, 0644);
|
||||
@ -110,7 +114,8 @@ proc_metadata_store(struct ovni_rproc *proc)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
snprintf(path, PATH_MAX, "%s/metadata.json", proc->dir);
|
||||
if(snprintf(path, PATH_MAX, "%s/metadata.json", proc->dir) >= PATH_MAX)
|
||||
abort();
|
||||
|
||||
assert(proc->meta != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user