mirror of
https://repo.or.cz/socat.git
synced 2025-06-18 14:56:51 +00:00
Corrections for Ubuntu-24 with newer compilers
This commit is contained in:
parent
676888e8cc
commit
63f67101f4
5 changed files with 27 additions and 17 deletions
4
CHANGES
4
CHANGES
|
@ -60,6 +60,10 @@ Corrections:
|
||||||
now handled properly.
|
now handled properly.
|
||||||
Test: UNIX_L_BIND
|
Test: UNIX_L_BIND
|
||||||
|
|
||||||
|
Removed unused bytes variable from gettimestamp(), corrected #elsif and
|
||||||
|
socks4 record length.
|
||||||
|
Thanks to clang-18 and gcc-13.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
POSIXMQ-RECV now takes option o-nonblock; this, in combination with -T,
|
POSIXMQ-RECV now takes option o-nonblock; this, in combination with -T,
|
||||||
makes it possible to terminate Socat in case the queue is empty.
|
makes it possible to terminate Socat in case the queue is empty.
|
||||||
|
|
8
socat.c
8
socat.c
|
@ -1339,7 +1339,6 @@ int _socat(void) {
|
||||||
should be at least MAXTIMESTAMPLEN bytes long.
|
should be at least MAXTIMESTAMPLEN bytes long.
|
||||||
returns 0 on success or -1 if an error occurred */
|
returns 0 on success or -1 if an error occurred */
|
||||||
int gettimestamp(char *timestamp) {
|
int gettimestamp(char *timestamp) {
|
||||||
size_t bytes;
|
|
||||||
#if HAVE_CLOCK_GETTIME
|
#if HAVE_CLOCK_GETTIME
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
||||||
|
@ -1367,17 +1366,16 @@ int gettimestamp(char *timestamp) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_STRFTIME
|
#if HAVE_STRFTIME
|
||||||
bytes = strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
||||||
#if HAVE_CLOCK_GETTIME
|
#if HAVE_CLOCK_GETTIME
|
||||||
bytes += sprintf(timestamp+19, "."F_tv_nsec" ", now.tv_nsec/1000);
|
sprintf(timestamp+19, "."F_tv_nsec" ", now.tv_nsec/1000);
|
||||||
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
||||||
bytes += sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec);
|
sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec);
|
||||||
#else
|
#else
|
||||||
strncpy(×tamp[bytes++], " ", 2);
|
strncpy(×tamp[bytes++], " ", 2);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
strcpy(timestamp, ctime(&nowt));
|
strcpy(timestamp, ctime(&nowt));
|
||||||
bytes = strlen(timestamp);
|
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
26
test.sh
26
test.sh
|
@ -15787,25 +15787,33 @@ te="$td/test$N.stderr"
|
||||||
tdiff="$td/test$N.diff"
|
tdiff="$td/test$N.diff"
|
||||||
da="test$N $(date) $RANDOM"
|
da="test$N $(date) $RANDOM"
|
||||||
CMD0="$TRACE $SOCAT $opts STDIO SYSTEM:'tee /dev/stdout 2>/dev/null',pty,cfmakeraw"
|
CMD0="$TRACE $SOCAT $opts STDIO SYSTEM:'tee /dev/stdout 2>/dev/null',pty,cfmakeraw"
|
||||||
#set -vx
|
|
||||||
printf "test $F_n $TEST... " $N
|
|
||||||
{ echo "$da"; relsleep 10; } |eval "$CMD0" >"${tf}0" 2>"${te}0" &
|
|
||||||
pid0=$!
|
|
||||||
relsleep 2
|
|
||||||
TTY=$(tty |sed 's|/dev/||')
|
TTY=$(tty |sed 's|/dev/||')
|
||||||
pkill -USR1 -t $TTY socat || { echo "pkill -t $TTY -USR1 socat"; }
|
CMD1="pkill -USR1 -t $TTY socat"
|
||||||
|
printf "test $F_n $TEST... " $N
|
||||||
|
# On Fedora-41 pkill can be slow (eg.20ms)
|
||||||
|
{ echo "$da"; relsleep 20; } |eval "$CMD0" >"${tf}0" 2>"${te}0" &
|
||||||
|
pid0=$!
|
||||||
|
#date +'%Y-%m-%dT%H:%M:%S.%N' >>"${te}1"
|
||||||
relsleep 2
|
relsleep 2
|
||||||
pkill -t $TTY socat
|
#date +'%Y-%m-%dT%H:%M:%S.%N' >>"${te}1"
|
||||||
|
$CMD1 2>"${te}1"
|
||||||
|
relsleep 2
|
||||||
|
#date +'%Y-%m-%dT%H:%M:%S.%N' >>"${te}1"
|
||||||
wait
|
wait
|
||||||
|
pkill -t $TTY socat >>"${te}1"
|
||||||
if [ "$(grep STATISTICS "${te}0" |wc -l)" -eq 2 ]; then
|
if [ "$(grep STATISTICS "${te}0" |wc -l)" -eq 2 ]; then
|
||||||
$PRINTF "$OK\n"
|
$PRINTF "$OK\n"
|
||||||
if [ "$VERBOSE" ]; then echo "$CMD0"; fi
|
if [ "$VERBOSE" ]; then echo "$CMD0 &"; fi
|
||||||
if [ "$DEBUG" ]; then cat "${te}0" >&2; fi
|
if [ "$DEBUG" ]; then cat "${te}0" >&2; fi
|
||||||
|
if [ "$VERBOSE" ]; then echo "$CMD1"; fi
|
||||||
|
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
|
||||||
ok
|
ok
|
||||||
else
|
else
|
||||||
$PRINTF "$FAILED\n"
|
$PRINTF "$FAILED (no stats)\n"
|
||||||
echo "$CMD0 &"
|
echo "$CMD0 &"
|
||||||
cat "${te}0" >&2
|
cat "${te}0" >&2
|
||||||
|
echo "$CMD1"
|
||||||
|
cat "${te}1" >&2
|
||||||
failed
|
failed
|
||||||
fi
|
fi
|
||||||
fi # NUMCOND
|
fi # NUMCOND
|
||||||
|
|
2
xio-ip.c
2
xio-ip.c
|
@ -592,7 +592,7 @@ int _xiogetaddrinfo(const char *node, const char *service,
|
||||||
freehostent(host);
|
freehostent(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elsif 0 /* !HAVE_PROTOTYPE_LIB_getipnodebyname */
|
#elif 0 /* !HAVE_PROTOTYPE_LIB_getipnodebyname */
|
||||||
|
|
||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
/* this is not a typical IP6 resolver function - but Linux
|
/* this is not a typical IP6 resolver function - but Linux
|
||||||
|
|
|
@ -10,9 +10,9 @@ struct socks4 {
|
||||||
uint8_t action;
|
uint8_t action;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint32_t dest;
|
uint32_t dest;
|
||||||
char userid[1]; /* just to have access via this struct */
|
char userid[0]; /* just to have access via this struct */
|
||||||
} ;
|
} ;
|
||||||
#define SIZEOF_STRUCT_SOCKS4 8
|
#define SIZEOF_STRUCT_SOCKS4 ((size_t)&((struct socks4 *)0)->userid)
|
||||||
|
|
||||||
extern const struct optdesc opt_socksport;
|
extern const struct optdesc opt_socksport;
|
||||||
extern const struct optdesc opt_socksuser;
|
extern const struct optdesc opt_socksuser;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue