As per 'man 3 errno':
On some ancient systems, <errno.h> was not present or did not
declare errno, so that it was necessary to declare errno manually
(i.e., extern int errno). **Do not do this**. It long ago ceased
to be necessary, and it will cause problems with modern versions of
the C library.
One of the platforms it causes a problem on is Windows:
In file included from fgetversion.c:28:
fgetversion.c: In function ‘fgetversion’:
fgetversion.c:68:20: warning: ‘_errno’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
68 | extern int errno;
| ^~~~~
Just remove these obsolete manual declarations of errno.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
rc = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
# endif /* !APPLE_DARWIN */
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
-
errno = EOPNOTSUPP;
#endif /* ! HAVE_EXT2_IOCTLS */
if (rc == 0)
return syscall(SYS_fsctl, name, EXT2_IOC_SETVERSION, &ver, 0);
#endif
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
*version = ver;
return r;
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
ver = (int) version;
return ioctl (fd, EXT2_IOC_SETVERSION, &ver);
#else /* ! HAVE_EXT2_IOCTLS */
- extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include "ss_internal.h"
#include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include <fcntl.h>
#include <sys/param.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
-#else
-extern int errno;
#endif
#include "ss_internal.h"