* terminate string read from /proc
* terminate array for exclusive options
Signed-off-by: Karel Zak <kzak@redhat.com>
if (!ctl->possible_modes) {
char buf[256] = { 0 };
+ ssize_t ss;
fd = open(SYS_POWER_STATE_PATH, O_RDONLY);
if (fd < 0)
goto nothing;
- if (read(fd, &buf, sizeof(buf) - 1) <= 0)
+ ss = read(fd, &buf, sizeof(buf) - 1);
+ if (ss <= 0)
goto nothing;
+ buf[ss] = '\0';
ctl->possible_modes = strv_split(buf, " \n");
close(fd);
}
static const ul_excl_t excl[] = {
{ 'a', 'l', 'u' },
{ 's', 't', OPT_DATE },
+ { 0 },
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;