]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
lib/{e2p,ss}: remove manual declarations of errno
authorEric Biggers <ebiggers@google.com>
Sat, 21 Jan 2023 20:32:05 +0000 (12:32 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 27 Jan 2023 17:33:59 +0000 (12:33 -0500)
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>
lib/e2p/fgetversion.c
lib/e2p/fsetversion.c
lib/e2p/getversion.c
lib/e2p/setversion.c
lib/ss/execute_cmd.c
lib/ss/help.c
lib/ss/pager.c

index a65e9a5c5ff89f95d713ba44582957d16ecd842a..f3a5b4cdf2232897834915ab60f33e94566876cc 100644 (file)
@@ -65,8 +65,6 @@ int fgetversion(const char *name, unsigned long *version)
        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)
index c2e04559162fd7a2b44f3424e6aa48803b4ff075..5f844b55e6940d56b61a866a82fd6857a59b19b0 100644 (file)
@@ -65,7 +65,6 @@ int fsetversion (const char * name, unsigned long version)
    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 */
index 9f719b4a9ced1f3f0cdf7fca8fb63b2444d594b9..d374a0ea7df0ddbcdddad2bf4b11a0c6e18d681f 100644 (file)
@@ -35,7 +35,6 @@ int getversion (int fd, unsigned long * version)
        *version = ver;
        return r;
 #else /* ! HAVE_EXT2_IOCTLS */
-       extern int errno;
        errno = EOPNOTSUPP;
        return -1;
 #endif /* ! HAVE_EXT2_IOCTLS */
index 2bc933749475af573ffbede41b8facf48804b038..dd4a3f06bfb5c8e74269c1d5fd6e75a31d4ae3e7 100644 (file)
@@ -34,7 +34,6 @@ int setversion (int fd, unsigned long version)
        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 */
index 2e2c8cfa0f575c9d3694a6790c23614e2f741e32..d092134a3453ed475a0212750b25fde31e9e20e0 100644 (file)
@@ -17,8 +17,6 @@
 #endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
-#else
-extern int errno;
 #endif
 #include "ss_internal.h"
 #include <stdio.h>
index a22b40178912c2ec3e3b37cf32a0173a750d23d0..54c78f2397b5a07830ae1edf5ce8c960c0ff774a 100644 (file)
@@ -20,8 +20,6 @@
 #endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
-#else
-extern int errno;
 #endif
 #include <fcntl.h>
 #include <sys/param.h>
index b9b88996269d643376977dab659acbf10e1a6a30..ba32b20194440cc8eb897aab32f807aadb53d694 100644 (file)
@@ -20,8 +20,6 @@
 #endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
-#else
-extern int errno;
 #endif
 
 #include "ss_internal.h"