Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ static inline bool pr_quelled(unsigned int loglevel)
static void __print_on_level(unsigned int loglevel, const char *format, va_list params)
{
size_t size;

int ret;

if (logfd < 0)
return;

size = vsnprintf(logbuf, PAGE_SIZE, format, params);
write(logfd, logbuf, size);
ret = write(logfd, logbuf, size);
if (ret < 0)
pr_err("Write on %s failed\n", __func__);
}

void print_on_level(unsigned int loglevel, const char *format, ...)
Expand Down
10 changes: 7 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int pack_compel_obj(char **obj, size_t nobj,
const char *lib_path, char **libs, size_t nlibs, char *out)
{
char command[1024] = { 0 };
char data[1024] = { 0 };
char data[1024] = { 0 }, *retc;
int ret = -1, pos, i;
FILE *f;

Expand Down Expand Up @@ -66,11 +66,15 @@ static int pack_compel_obj(char **obj, size_t nobj,

f = popen(command, "r");
if (f) {
fgets(data, sizeof(data), f);
retc = fgets(data, sizeof(data), f);
if (!retc){
pr_err("Can't read data from file\n");
goto end_ret;
}
ret = data[0] == '\0' ? 0 : 1;
pclose(f);
if (!ret)
ret = libcompel_verify_packed(out ? : COMPEL_DEFAULT_PACK_OUT);
end_ret: ret = libcompel_verify_packed(out ? : COMPEL_DEFAULT_PACK_OUT);
} else
pr_perror("Can't run pack");
if (ret)
Expand Down