mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
tty: Check input arguments for invalid tty before adding.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
56ef3f75d3
commit
263036045a
1 file changed
+5
-1
@@ -50,8 +50,12 @@ typedef struct node {
|
|||||||
LIST_HEAD(, node) node_list = LIST_HEAD_INITIALIZER();
|
LIST_HEAD(, node) node_list = LIST_HEAD_INITIALIZER();
|
||||||
int tty_add(char *tty, int baud)
|
int tty_add(char *tty, int baud)
|
||||||
{
|
{
|
||||||
node_t *entry = malloc(sizeof(*entry));
|
node_t *entry;
|
||||||
|
|
||||||
|
if (!tty)
|
||||||
|
return errno = EINVAL;
|
||||||
|
|
||||||
|
entry = malloc(sizeof(*entry));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return errno = ENOMEM;
|
return errno = ENOMEM;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user