mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
MFP4: 109653
Linux mknod(2) can open any files, not just char/block or fifo files. This fixes Linux Test Project test cases mknod01, mknod07 and mknod09.
This commit is contained in:
parent
323c565bed
commit
b34608fea5
1 changed files with 25 additions and 2 deletions
|
|
@ -890,11 +890,34 @@ linux_mknod(struct thread *td, struct linux_mknod_args *args)
|
|||
printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev);
|
||||
#endif
|
||||
|
||||
if (S_ISFIFO(args->mode))
|
||||
switch (args->mode & S_IFMT) {
|
||||
case S_IFIFO:
|
||||
case S_IFSOCK:
|
||||
error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode);
|
||||
else
|
||||
break;
|
||||
|
||||
case S_IFCHR:
|
||||
case S_IFBLK:
|
||||
error = kern_mknod(td, path, UIO_SYSSPACE, args->mode,
|
||||
args->dev);
|
||||
break;
|
||||
|
||||
case S_IFDIR:
|
||||
error = EPERM;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
args->mode |= S_IFREG;
|
||||
/* fall through */
|
||||
case S_IFREG:
|
||||
error = kern_open(td, path, UIO_SYSSPACE,
|
||||
O_WRONLY | O_CREAT | O_TRUNC, args->mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
LFREEPATH(path);
|
||||
return (error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue