diff --git a/tools/lkl/include/lkl.h b/tools/lkl/include/lkl.h index a20651472a9471..ae7396276e1bf4 100644 --- a/tools/lkl/include/lkl.h +++ b/tools/lkl/include/lkl.h @@ -428,7 +428,7 @@ struct lkl_netdev *lkl_netdev_macvtap_create(const char *path, int offload); * If you run the program from shell script, make sure you ignore SIGTSTP by * "trap '' TSTP" in the shell script. */ -void lkl_register_dbg_handler(); +void lkl_register_dbg_handler(void); /** * lkl_add_neighbor - add a permanent arp entry diff --git a/tools/lkl/lib/fs.c b/tools/lkl/lib/fs.c index e5ef086972a13e..b27acee8cb77bc 100644 --- a/tools/lkl/lib/fs.c +++ b/tools/lkl/lib/fs.c @@ -80,6 +80,7 @@ int lkl_encode_dev_from_sysfs(const char *sysfs_path, uint32_t *pdevid) long fd; int major, minor; char buf[16] = { 0, }; + char *bufptr; fd = lkl_sys_open(sysfs_path, LKL_O_RDONLY, 0); if (fd < 0) @@ -94,11 +95,16 @@ int lkl_encode_dev_from_sysfs(const char *sysfs_path, uint32_t *pdevid) goto out_close; } - ret = sscanf(buf, "%d:%d", &major, &minor); - if (ret != 2) { + bufptr = strchr(buf, ':'); + if (bufptr == NULL) { ret = -LKL_EINVAL; goto out_close; } + bufptr[0] = '\0'; + bufptr++; + + major = atoi(buf); + minor = atoi(bufptr); *pdevid = new_encode_dev(major, minor); ret = 0; @@ -356,7 +362,7 @@ struct lkl_dir *lkl_fdopendir(int fd, int *err) void lkl_rewinddir(struct lkl_dir *dir) { - lkl_sys_lseek(dir->fd, 0, SEEK_SET); + lkl_sys_lseek(dir->fd, 0, LKL_SEEK_SET); dir->len = 0; dir->pos = NULL; }