Skip to content

Commit 5f435f4

Browse files
committed
add test
1 parent f2281ce commit 5f435f4

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

ext/posix/posix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,5 +1398,6 @@ PHP_FUNCTION(posix_mknodat)
13981398
RETURN_FALSE;
13991399
}
14001400

1401+
RETURN_TRUE;
14011402
}
14021403
#endif

ext/posix/posix.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,5 +462,5 @@ function posix_mkfifoat($file_descriptor, string $path, int $permissions): bool
462462

463463
#ifdef HAVE_MKNODAT
464464
/** @param resource|int $file_descriptor */
465-
function posix_mknodat($file_descriptor, string $filename, int $flags, int $major = 0, int $minor = 0): bool {}
465+
function posix_mknodat($file_descriptor, string $path, int $flags, int $major = 0, int $minor = 0): bool {}
466466
#endif

ext/posix/posix_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/posix/tests/posix_mknodat.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
posix_mknodat support
3+
--EXTENSIONS--
4+
posix
5+
--SKIPIF--
6+
<?php
7+
if (!function_exists('posix_mknodat')) die('skip posix_mknodat() not found');
8+
?>
9+
--FILE--
10+
<?php
11+
12+
$fd = fopen(__DIR__, "r");
13+
var_dump(posix_mknodat($fd, 'dev', POSIX_S_IFBLK | 0777, 1, 0));
14+
var_dump(posix_mknodat($fd, __DIR__ . '/dev', POSIX_S_IFBLK | 0777, 1, 0));
15+
try {
16+
posix_mknodat($fd, __DIR__ . '/dev', POSIX_S_IFBLK | 0777, 0, 0);
17+
} catch (\ValueError $e) {
18+
echo $e->getMessage();
19+
}
20+
fclose($fd);
21+
?>
22+
--EXPECT--
23+
bool(false)
24+
bool(false)
25+
posix_mknodat(): Argument #4 ($major) cannot be 0 for the POSIX_S_IFCHR and POSIX_S_IFBLK modes

0 commit comments

Comments
 (0)