diff options
-rw-r--r-- | libsmartcols/src/table.c | 3 | ||||
-rw-r--r-- | sys-utils/swapon.c | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index 9aae75c95..4040b4365 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -68,6 +68,7 @@ struct libscols_table *scols_new_table(void) tb->refcount = 1; tb->out = stdout; + tb->termwidth = get_terminal_width(80); INIT_LIST_HEAD(&tb->tb_lines); INIT_LIST_HEAD(&tb->tb_columns); @@ -1154,7 +1155,5 @@ int scols_table_set_termwidth(struct libscols_table *tb, size_t width) */ size_t scols_table_get_termwidth(struct libscols_table *tb) { - if (tb->termwidth == 0) - tb->termwidth = get_terminal_width(80); return tb->termwidth; } diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 62a776d40..0ee5caf44 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -688,6 +688,7 @@ static int swapon_by_uuid(struct swapon_ctl *ctl, const char *uuid) static int parse_options(struct swap_prop *props, const char *options) { char *arg = NULL; + size_t argsz = 0; assert(props); assert(options); @@ -695,16 +696,16 @@ static int parse_options(struct swap_prop *props, const char *options) if (mnt_optstr_get_option(options, "nofail", NULL, 0) == 0) props->no_fail = 1; - if (mnt_optstr_get_option(options, "discard", &arg, NULL) == 0) { + if (mnt_optstr_get_option(options, "discard", &arg, &argsz) == 0) { props->discard |= SWAP_FLAG_DISCARD; if (arg) { /* only single-time discards are wanted */ - if (strcmp(arg, "once") == 0) + if (strncmp(arg, "once", argsz) == 0) props->discard |= SWAP_FLAG_DISCARD_ONCE; /* do discard for every released swap page */ - if (strcmp(arg, "pages") == 0) + if (strncmp(arg, "pages", argsz) == 0) props->discard |= SWAP_FLAG_DISCARD_PAGES; } } |