Opened 3 months ago

Closed 3 months ago

#19032 closed bug (fixed)

mknod and mknodat don't support the S_IFIFO flag

Reported by: bhaible Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: System/POSIX Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

According to POSIX https://pubs.opengroup.org/onlinepubs/9799919799/functions/mknod.html, mknod() and mknodat() with an argument flag of S_IFIFO and a zero device argument should act like mkfifo() and mkfifoat(), respectively.

This does not work in Haiku hrev57823 (from 2024-07-15).

How to reproduce: Store this as foo.c.

#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

int main ()
{
  int ret;

  ret = mkfifo ("test1", 0600);
  printf ("ret = %d\n", ret);
  ret = mkfifoat (AT_FDCWD, "test2", 0600);
  printf ("ret = %d\n", ret);

  ret = mknod ("test3", 0600 | S_IFIFO, 0);
  if (ret < 0) perror ("mknod");
  printf ("ret = %d\n", ret);
  ret = mknodat (AT_FDCWD, "test4", 0600 | S_IFIFO, 0);
  if (ret < 0) perror ("mknodat");
  printf ("ret = %d\n", ret);
}

Compile and run this program:

gcc -Wall foo.c
rm -f test1 test2 test3 test4
./a.out

Expected output:

ret = 0
ret = 0
ret = 0
ret = 0

Actual output:

ret = 0
ret = 0
mknod: Not supported
ret = -1
mknodat: Not supported
ret = -1

Attachments (1)

foo.c (474 bytes ) - added by bhaible 3 months ago.
test case foo.c

Download all attachments as: .zip

Change History (3)

by bhaible, 3 months ago

Attachment: foo.c added

test case foo.c

comment:1 by waddlesplash, 3 months ago

Component: - GeneralSystem/POSIX

comment:2 by waddlesplash, 3 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev58037 +beta5.

Note: See TracTickets for help on using tickets.