Skip to content

Commit

Permalink
fix: centos8 memory fix (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
thefab authored Oct 14, 2021
1 parent b1ba9b7 commit 623f94d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/log_proxy_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ GOptionEntry *change_options()
int number_of_options = sizeof(entries) / sizeof(entries[0]);
// we remove 2 options and we add 3 new
GOptionEntry *res = g_malloc(sizeof(GOptionEntry) * (number_of_options + 1));
for (int i = 0 ; i < number_of_options ; i++) {
for (int i = 0 ; i < number_of_options - 1; i++) {
if (g_strcmp0(entries[i].long_name, "fifo") == 0) {
continue;
}
Expand All @@ -33,9 +33,10 @@ GOptionEntry *change_options()
}
res[i] = entries[i];
}
res[number_of_options - 2] = new_entry1;
res[number_of_options - 1] = new_entry2;
res[number_of_options] = new_entry3;
res[number_of_options - 3] = new_entry1;
res[number_of_options - 2] = new_entry2;
res[number_of_options - 1] = new_entry3;
res[number_of_options] = entries[number_of_options - 1];
return res;
}

Expand Down
3 changes: 2 additions & 1 deletion src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ static GOptionEntry entries[] = {
{ "chgrp", 'g', 0, G_OPTION_ARG_STRING, &chgrp_str, "if set, try (if you don't have sufficient privileges, it will fail silently) to change the group of the logfile to the given group value", NULL },
{ "use-locks", 'm', 0, G_OPTION_ARG_NONE, &use_locks, "use locks to append to main log file (useful if several process writes to the same file)", NULL },
{ "fifo", 'f', 0, G_OPTION_ARG_STRING, &fifo, "if set, read lines on this fifo instead of stdin", NULL },
{ "rm-fifo-at-exit", 'r', 0, G_OPTION_ARG_NONE, &rm_fifo_at_exit, "if set, drop fifo at then end of the program (you have to use --fifo option of course)", NULL }
{ "rm-fifo-at-exit", 'r', 0, G_OPTION_ARG_NONE, &rm_fifo_at_exit, "if set, drop fifo at then end of the program (you have to use --fifo option of course)", NULL },
{ NULL }
};

#endif /* OPTIONS_H_ */

0 comments on commit 623f94d

Please sign in to comment.