ioctl() IOCTL_STAT use path instead of already open io handle

This commit is contained in:
2025-10-02 23:57:38 +02:00
parent c345e2284e
commit 2cfd3ee2fa
4 changed files with 21 additions and 8 deletions

View File

@ -18,7 +18,7 @@ void fs_fetch(void) {
IoctlStat statbuf; ZERO(&statbuf);
ioctl(ioh, IOCTL_STAT, (uint64_t)&statbuf, 0, 0);
ioctl(ioh, IOCTL_STAT, (uint64_t)&statbuf, (uint64_t)path, 0);
if (statbuf.type == IOCTLSTAT_FILE) {
uint8_t *buf = umalloc(statbuf.size+1);
string_memset(buf, 0, statbuf.size+1);
@ -31,5 +31,8 @@ void fs_fetch(void) {
}
uprintf("%s", buf);
ufree(buf);
}
ioctl(ioh, IOCTL_CLOSEF, 0, 0, 0);
}

View File

@ -68,7 +68,7 @@ void do_file(char *filepath) {
IoctlStat statbuf; ZERO(&statbuf);
ioctl(ioh, IOCTL_STAT, (uint64_t)&statbuf, 0, 0);
ioctl(ioh, IOCTL_STAT, (uint64_t)&statbuf, (uint64_t)filepath, 0);
if (statbuf.type != IOCTLSTAT_FILE) {
LOG(LOG_ERR, "%s is not a file (%d)\n", filepath, statbuf.type);
return;