[LTP] [PATCH v4 8/8] syscalls/mknod08: Convert to new API

Ricardo B. Marlière rbm@suse.com
Thu Jun 5 14:53:38 CEST 2025


On Thu Jun 5, 2025 at 4:23 AM -03, Petr Vorel wrote:
> Hi Ricardo,
>
> ...
>> -/*
>> - * Test Name: mknod08
>> - *
>> - * Test Description:
>> - *  Verify that mknod(2) succeeds when used to create a filesystem
>> - *  node on a directory without set group-ID bit set. The node created
>> - *  should not have set group-ID bit set and its gid should be equal to that
>> - *  of its parent directory.
>> - *
>> - * Expected Result:
>> - *  mknod() should return value 0 on success and node created should not
>> - *  have set group-ID bit set.
>> - *
>> - * Algorithm:
>> - *  Setup:
>> - *   Setup signal handling.
>> - *   Create temporary directory.
>> - *   Pause for SIGUSR1 if option specified.
>> - *
>> - *  Test:
>> - *   Loop if the proper options are given.
>> - *   Execute system call
>> - *   Check return code, if system call failed (return=-1)
>> - *	Log the errno and Issue a FAIL message.
>> - *   Otherwise,
>> - *	Verify the Functionality of system call
>> - *      if successful,
>> - *		Issue Functionality-Pass message.
>> - *      Otherwise,
>> - *		Issue Functionality-Fail message.
> ...
>> +/*\
>> + * Verify that mknod(2) succeeds when used to create a filesystem node on a
>> + * directory without set group-ID bit set. The node created should not have
>> + * set group-ID bit set and its gid should be equal to that of its parent
>> + * directory.
>>   */
>
> ...
>> -#define MODE_RWX	S_IFIFO | S_IRWXU | S_IRWXG | S_IRWXO
>> +#define MODE_RWX 0777
>
> I'm not sure if that's omitted by accident or intentional, but I don't think
> it's ok to drop S_IFIFO:
>
> man mknod(2):
>
>        The file type must be one of S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO,
>        or S_IFSOCK to specify a regular file (which will be created
>        empty), character special file, block special file, FIFO (named
>        pipe), or UNIX domain socket, respectively.  (Zero file type is
>        equivalent to type S_IFREG.)
> => we don't test on named pipe but on a regular file.
>
> Could you please use the same approach as you use in mknod06.c?
> #define MODE_FIFO_RWX (S_IFIFO | 0777)

Ah sure thing, sorry about overlooking this.

>
> ...
>> +uid_t nobody_uid;
>> +gid_t nobody_gid, free_gid;
>
> make check reports:
>
> mknod08.c:24:7: warning: Symbol 'nobody_uid' has no prototype or library ('tst_') prefix. Should it be static?
> mknod08.c:25:7: warning: Symbol 'nobody_gid' has no prototype or library ('tst_') prefix. Should it be static?
> mknod08.c:25:19: warning: Symbol 'free_gid' has no prototype or library ('tst_') prefix. Should it be static?

oops, good catch

>
> With that fixed you can add:
> Reviewed-by: Petr Vorel <pvorel@suse.cz>

Thanks for reviewing,
-	Ricardo.


>
> Kind regards,
> Petr



More information about the ltp mailing list