Project

General

Profile

Actions

Bug #3282

open

unexpected errno value from fopen()

Added by bhaible over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Userland
Target version:
Start date:
06/14/2021
Due date:
% Done:

0%

Estimated time:

Description

fopen(".", "w") fails with errno = EEXIST.
Per POSIX https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
one would expect one of EISDIR, EINVAL, EACCES.

How to reproduce: Run this program.

#include <errno.h>
#include <stdio.h>

int main ()
{
  FILE *fp = fopen (".", "w");
  if (fp == NULL)
    {
      perror ("fopen");
    }
}

Actions

Also available in: Atom PDF