--- ./librepo/checksum.c_orig	2022-02-07 03:43:24 +0000
+++ ./librepo/checksum.c	2022-02-07 04:22:34 +0000
@@ -26,7 +26,11 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifndef _AIX
 #include <sys/xattr.h>
+#else
+#include <sys/ea.h>
+#endif
 #include <unistd.h>
 #include <openssl/evp.h>
 
@@ -226,7 +230,7 @@
 
             key = g_strdup_printf("user.Zif.MdChecksum[%llu]",
                                   (unsigned long long) st.st_mtime);
-            ssize_t attr_size = fgetxattr(fd, key, &buf, sizeof(buf));
+            ssize_t attr_size = fgetea(fd, key, &buf, sizeof(buf));
             if (attr_size != -1) {
                 // Cached checksum found
                 g_debug("%s: Using checksum cached in xattr: [%s] %s",
@@ -253,7 +257,7 @@
             _cleanup_free_ gchar *key = NULL;
             key = g_strdup_printf("user.Zif.MdChecksum[%llu]",
                                   (unsigned long long) st.st_mtime);
-            fsetxattr(fd, key, checksum, strlen(checksum)+1, 0);
+            fsetea(fd, key, checksum, strlen(checksum)+1, 0);
         }
     }
 
--- ./librepo/downloader.c_orig	2022-02-07 03:44:38 +0000
+++ ./librepo/downloader.c	2022-02-07 06:09:18 +0000
@@ -31,7 +31,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#ifndef _AIX
 #include <sys/xattr.h>
+#else
+#include <sys/ea.h>
+#endif
 #include <fcntl.h>
 #include <curl/curl.h>
 
@@ -977,7 +981,7 @@
     else
         dst = g_strdup(fn);
 
-    int attr_ret = fsetxattr(fd, XATTR_LIBREPO, "1", 1, 0);
+    int attr_ret = fsetea(fd, XATTR_LIBREPO, "1", 1, 0);
     if (attr_ret == -1) {
         g_debug("%s: Cannot set xattr %s (%s): %s",
                 __func__, XATTR_LIBREPO, dst, g_strerror(errno));
@@ -990,7 +994,7 @@
 static gboolean
 has_librepo_xattr(int fd)
 {
-    ssize_t attr_ret = fgetxattr(fd, XATTR_LIBREPO, NULL, 0);
+    ssize_t attr_ret = fgetea(fd, XATTR_LIBREPO, NULL, 0);
     if (attr_ret == -1) {
         //g_debug("%s: Cannot get xattr %s: %s",
         //        __func__, XATTR_LIBREPO, g_strerror(errno));
@@ -1007,7 +1011,7 @@
 {
     int fd = target->fd;
     if (fd != -1) {
-        fremovexattr(fd, XATTR_LIBREPO);
+        fremoveea(fd, XATTR_LIBREPO);
         return;
     }
     // If file descriptor wasn't set, file name was, and we need to open it
@@ -1015,7 +1019,7 @@
     if (fd == -1) {
         return;
     }
-    fremovexattr(fd, XATTR_LIBREPO);
+    fremoveea(fd, XATTR_LIBREPO);
     close(fd);
 }
 
@@ -2302,8 +2306,10 @@
             curl_easy_getinfo(target->curl_handle, CURLINFO_FILETIME, &remote_filetime);
             if (remote_filetime >= 0) {
                 const struct timeval tv[] = {{remote_filetime, 0}, {remote_filetime, 0}};
+#ifndef _AIX
                 if (futimes(fileno(target->f), tv) == -1)
                     g_debug("%s: Failed to change timestamps of downloaded file.", __func__);
+#endif
             } else {
                 g_debug("%s: Unable to get remote time of retrieved document \"%s\"",
                         __func__, target->target->path);
--- ./librepo/python/metadatatarget-py.c_orig	2022-02-07 03:45:32 +0000
+++ ./librepo/python/metadatatarget-py.c	2022-02-07 03:46:29 +0000
@@ -17,8 +17,9 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-
+#ifndef _AIX
 #include <err.h>
+#endif
 
 #include "librepo/librepo.h"
 #include "librepo/downloader_internal.h"
--- ./librepo/downloader.c.orig	2023-10-11 01:23:50.813733189 +0000
+++ ./librepo/downloader.c	2023-10-11 01:32:49.850705527 +0000
@@ -2305,11 +2305,9 @@
             long remote_filetime = -1;
             curl_easy_getinfo(target->curl_handle, CURLINFO_FILETIME, &remote_filetime);
             if (remote_filetime >= 0) {
-                const struct timeval tv[] = {{remote_filetime, 0}, {remote_filetime, 0}};
-#ifndef _AIX
-                if (futimes(fileno(target->f), tv) == -1)
+                const struct timespec ts[] = {{remote_filetime, 0}, {remote_filetime, 0}};
+                if (futimens(fileno(target->f), ts) == -1)
                     g_debug("%s: Failed to change timestamps of downloaded file.", __func__);
-#endif
             } else {
                 g_debug("%s: Unable to get remote time of retrieved document \"%s\"",
                         __func__, target->target->path);
