0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 00:10:52 +00:00
termux-packages/packages/socat/0002-fix-format-specifiers-for-32-bit-archs.patch
2023-12-09 13:46:43 +08:00

90 lines
2.8 KiB
Diff

--- a/filan.c
+++ b/filan.c
@@ -261,7 +261,11 @@
headprinted = 1;
}
if (filan_rawoutput) {
+#if defined __ANDROID__ && !defined __LP64__
+ snprintf(stdevstr, 8, "%llu", buf->st_dev);
+#else
snprintf(stdevstr, 8, F_dev, buf->st_dev);
+#endif
} else {
snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)(buf->st_dev>>8), (unsigned short)(buf->st_dev&0xff));
}
@@ -271,7 +275,11 @@
#else
F_st_ino
#endif /* HAVE_STAT64 */
+#if defined __ANDROID__ && !defined __LP64__
+ "\t%u\t"F_st_nlink"\t"F_uid"\t"F_gid
+#else
"\t"F_mode"\t"F_st_nlink"\t"F_uid"\t"F_gid
+#endif
#if HAVE_ST_RDEV
"\t%hu,%hu"
#endif
--- a/procan.c
+++ b/procan.c
@@ -306,8 +306,12 @@ int procan(FILE *outfile) {
fprintf(outfile, "#define __STDC_VERSION__ %ld\n", __STDC_VERSION__);
#endif
#ifdef SIZE_MAX
+#if defined __ANDROID__ && !defined __LP64__
+ fprintf(outfile, "SIZE_MAX = %-24u\n", SIZE_MAX);
+#else
fprintf(outfile, "SIZE_MAX = "F_Zu" /* maximum value of size_t */\n", SIZE_MAX);
#endif
+#endif
#ifdef P_tmpdir
fprintf(outfile, "P_tmpdir = \"%s\"\n", P_tmpdir);
#endif
--- a/sycls.c
+++ b/sycls.c
@@ -395,12 +395,22 @@
static void prtstat(const char *func, struct stat *buf, int result) {
char txt[256], *t = txt;
+#if defined __ANDROID__ && !defined __LP64__
+ t += sprintf(t, "%s(, {%llu,"F_st_ino",%u,"F_st_nlink","F_uid","F_gid,
+ func, buf->st_dev, buf->st_ino,
+ buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
+#else
t += sprintf(t, "%s(, {"F_dev","F_st_ino","F_mode","F_st_nlink","F_uid","F_gid,
func, buf->st_dev, buf->st_ino,
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
+#endif
#if HAVE_ST_RDEV
+#if defined __ANDROID__ && !defined __LP64__
+ t += sprintf(t, ",%llu", buf->st_rdev);
+#else
t += sprintf(t, ","F_dev, buf->st_rdev);
#endif
+#endif
t += sprintf(t, ","F_st_size, buf->st_size);
#if HAVE_ST_BLKSIZE
t += sprintf(t, ","F_st_blksize, buf->st_blksize);
@@ -419,12 +429,22 @@
if (result < 0) {
sprintf(t, "%s(, {}) -> %d", func, result);
} else {
+#if defined __ANDROID__ && !defined __LP64__
+ t += sprintf(t, "%s(, {%llu,"F_st64_ino",%u,"F_st_nlink","F_uid","F_gid,
+ func, buf->st_dev, buf->st_ino,
+ buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
+#else
t += sprintf(t, "%s(, {"F_dev","F_st64_ino","F_mode","F_st_nlink","F_uid","F_gid,
func, buf->st_dev, buf->st_ino,
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_gid);
+#endif
#if HAVE_ST_RDEV
+#if defined __ANDROID__ && !defined __LP64__
+ t += sprintf(t, ",%llu", buf->st_rdev);
+#else
t += sprintf(t, ","F_dev, buf->st_rdev);
#endif
+#endif
t += sprintf(t, ","F_st64_size, buf->st_size);
#if HAVE_ST_BLKSIZE
t += sprintf(t, ","F_st_blksize, buf->st_blksize);