mpg123: mpg123-1.30.2

From b26727f0be8456567b1a1deb5fd60d2a4c7dba8c Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 5 Aug 2022 08:45:24 +0300
Subject: [PATCH] mpg123-1.30.2

---
 NEWS                |  5 +++++
 configure           | 20 ++++++++++----------
 configure.ac        |  2 +-
 mpg123.spec         |  2 +-
 src/compat/compat.c |  8 ++++----
 5 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/NEWS b/NEWS
index a249368..ea49031 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+1.30.2
+------
+- Only use EWOULDBLOCK if the macro is defined (FreeBSD misses it for
+   _POSIX_SOURCE, bug 339).
+
 1.30.1
 ------
 - mpg123:
diff --git a/configure b/configure
index f34ae4a..7630b08 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mpg123 1.30.1.
+# Generated by GNU Autoconf 2.69 for mpg123 1.30.2.
 #
 # Report bugs to <maintainer@mpg123.org>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mpg123'
 PACKAGE_TARNAME='mpg123'
-PACKAGE_VERSION='1.30.1'
-PACKAGE_STRING='mpg123 1.30.1'
+PACKAGE_VERSION='1.30.2'
+PACKAGE_STRING='mpg123 1.30.2'
 PACKAGE_BUGREPORT='maintainer@mpg123.org'
 PACKAGE_URL=''
 
@@ -1683,7 +1683,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mpg123 1.30.1 to adapt to many kinds of systems.
+\`configure' configures mpg123 1.30.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1754,7 +1754,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mpg123 1.30.1:";;
+     short | recursive ) echo "Configuration of mpg123 1.30.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1988,7 +1988,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mpg123 configure 1.30.1
+mpg123 configure 1.30.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2594,7 +2594,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mpg123 $as_me 1.30.1, which was
+It was created by mpg123 $as_me 1.30.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3553,7 +3553,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mpg123'
- VERSION='1.30.1'
+ VERSION='1.30.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20656,7 +20656,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mpg123 $as_me 1.30.1, which was
+This file was extended by mpg123 $as_me 1.30.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -20722,7 +20722,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mpg123 config.status 1.30.1
+mpg123 config.status 1.30.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 95f56e3..9e6d91b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl 2.69 at least.
 AC_PREREQ([2.69])
 
 dnl ############# Initialisation
-AC_INIT([mpg123], [1.30.1], [maintainer@mpg123.org])
+AC_INIT([mpg123], [1.30.2], [maintainer@mpg123.org])
 dnl Increment API_VERSION when the API gets changes (new functions).
 
 dnl libmpg123
diff --git a/mpg123.spec b/mpg123.spec
index 90188f8..96ab78e 100644
--- a/mpg123.spec
+++ b/mpg123.spec
@@ -3,7 +3,7 @@
 # - devel packages for alsa, sdl, etc... to build the respective output modules.
 Summary:	The fast console mpeg audio decoder/player.
 Name:		mpg123
-Version:	1.30.1
+Version:	1.30.2
 Release:	1
 URL:		http://www.mpg123.org/
 License:	GPL
diff --git a/src/compat/compat.c b/src/compat/compat.c
index 6e724c2..dacc77b 100644
--- a/src/compat/compat.c
+++ b/src/compat/compat.c
@@ -451,8 +451,9 @@ size_t unintr_write(int fd, void const *buffer, size_t bytes)
 			bytes   -= part;
 			written += part;
 		} else if(errno != EINTR && errno != EAGAIN
-#ifndef __KLIBC__
-			// OS/2 is funny with POSIX.
+#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
+			// Not all platforms define it (or only in more modern POSIX modes).
+			// Standard says it is supposed to be a macro, so simple check here.
 			&& errno != EWOULDBLOCK
 #endif
 		)
@@ -475,8 +476,7 @@ size_t unintr_read(int fd, void *buffer, size_t bytes)
 			bytes -= part;
 			got   += part;
 		} else if(errno != EINTR && errno != EAGAIN
-#ifndef __KLIBC__
-			// OS/2 is funny with POSIX.
+#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)
 			&& errno != EWOULDBLOCK
 #endif
 		)