vconsole-setup: add a bunch of assert()s
This commit is contained in:
@@ -155,6 +155,8 @@ static void context_load_config(Context *c) {
|
||||
}
|
||||
|
||||
static int verify_vc_device(int fd) {
|
||||
assert(fd >= 0);
|
||||
|
||||
unsigned char data[] = {
|
||||
TIOCL_GETFGCONSOLE,
|
||||
};
|
||||
@@ -171,8 +173,9 @@ static int verify_vc_allocation(unsigned idx) {
|
||||
}
|
||||
|
||||
static int verify_vc_allocation_byfd(int fd) {
|
||||
struct vt_stat vcs = {};
|
||||
assert(fd >= 0);
|
||||
|
||||
struct vt_stat vcs = {};
|
||||
if (ioctl(fd, VT_GETSTATE, &vcs) < 0)
|
||||
return -errno;
|
||||
|
||||
@@ -375,8 +378,9 @@ static void setup_remaining_vcs(int src_fd, unsigned src_idx, bool utf8) {
|
||||
struct unimapdesc unimapd;
|
||||
_cleanup_free_ struct unipair* unipairs = NULL;
|
||||
_cleanup_free_ void *fontbuf = NULL;
|
||||
int log_level = LOG_WARNING;
|
||||
int r;
|
||||
int log_level = LOG_WARNING, r;
|
||||
|
||||
assert(src_fd >= 0);
|
||||
|
||||
unipairs = new(struct unipair, USHRT_MAX);
|
||||
if (!unipairs)
|
||||
@@ -549,6 +553,8 @@ static int verify_source_vc(char **ret_path, const char *src_vc) {
|
||||
char *path;
|
||||
int r;
|
||||
|
||||
assert(ret_path);
|
||||
|
||||
fd = open_terminal(src_vc, O_RDWR|O_CLOEXEC|O_NOCTTY);
|
||||
if (fd < 0)
|
||||
return log_error_errno(fd, "Failed to open %s: %m", src_vc);
|
||||
|
||||
Reference in New Issue
Block a user