]> git.tue.mpg.de Git - paraslash.git/log
paraslash.git
16 years agohttp_send.c: Never check the client fd for writability.
Andre Noll [Sat, 2 Feb 2008 13:28:25 +0000 (14:28 +0100)]
http_send.c: Never check the client fd for writability.

The fd is set to nonblocking mode, so writes will never
block but fail.

16 years agohttp_send.c: Kill HTTP_SENT_OK_MSG.
Andre Noll [Sat, 2 Feb 2008 12:49:25 +0000 (13:49 +0100)]
http_send.c: Kill HTTP_SENT_OK_MSG.

We might as well go directly to the HTTP_STREAMING state.

16 years ago{http,dccp}_send.c: Kill unused variable "self".
Andre Noll [Sat, 2 Feb 2008 11:44:59 +0000 (12:44 +0100)]
{http,dccp}_send.c: Kill unused variable "self".

16 years agohttp_send.c: Get rid of write_ok().
Andre Noll [Sat, 2 Feb 2008 11:27:11 +0000 (12:27 +0100)]
http_send.c: Get rid of write_ok().

Just use http_write() instead of write().

16 years agodccp_send.c: Fix a header sending bug.
Andre Noll [Sat, 2 Feb 2008 11:20:22 +0000 (12:20 +0100)]
dccp_send.c: Fix a header sending bug.

If the dccp sender is asked to send out an empty chunk, it
returns immediately without doing anything. However, we
might want to send the audio file header or the queued chunks
in this case. So always loop over all connected clients to see
if we can send something.

Moreover, if we are not listending on the dccp port, there can
not be any dccp clients, so the loop over all clients will be
an empty loop. Thus we may skip the initial check for an early
return completely.

16 years agohttp_send.c: Get rid of HTTP_READY_TO_STREAM.
Andre Noll [Sat, 2 Feb 2008 10:50:42 +0000 (11:50 +0100)]
http_send.c: Get rid of HTTP_READY_TO_STREAM.

The only reason for this state was to know whether we
already sent the audio file header. Store this info in
the new header_sent member of struct http_client.

This simplifies the code a bit and makes it more similar
to the dccp sending code.

16 years ago[TRIVIAL] dccp_send.c: Decrease scope of header_len.
Andre Noll [Sat, 2 Feb 2008 10:47:23 +0000 (11:47 +0100)]
[TRIVIAL] dccp_send.c: Decrease scope of header_len.

16 years agohttp_send.c: Introduce http_write.
Andre Noll [Sat, 2 Feb 2008 10:25:43 +0000 (11:25 +0100)]
http_send.c: Introduce http_write.

This allows to get rid of write_ok() and makes
send_queued_chunks() identical to its counterpart
in the dccp sender.

16 years agosendall(): Replace send() by write().
Andre Noll [Fri, 1 Feb 2008 23:02:33 +0000 (00:02 +0100)]
sendall(): Replace send() by write().

With zero flags parameter, send() is  equivalent  to  write(2).

16 years agodccp_senc.c: Kill E_DCCP_WRITE.
Andre Noll [Fri, 1 Feb 2008 22:40:24 +0000 (23:40 +0100)]
dccp_senc.c: Kill E_DCCP_WRITE.

Use ERRNO_TO_PARA_ERROR() instead.

16 years ago[DCCP]: Use 8000 as port.
Andre Noll [Mon, 21 Jan 2008 12:36:41 +0000 (13:36 +0100)]
[DCCP]: Use 8000 as port.

From: Gerrit Renker

As TCP and DCCP are different transport protocols, it is possible
to let both the dccp and the http sender listen on port 8000.

16 years agoBe more careful on command exit.
Andre Noll [Mon, 21 Jan 2008 08:24:16 +0000 (09:24 +0100)]
Be more careful on command exit.

If the callback returned zero, there's nothing to do.
If it returned positive, we have to send out the result
buffer and must free it afterwards. Sending the buffer may
well lead to an error condition, so always check the return
value of the corresponding call to send_buffer(). Finally,
it the command handler returned a negative value, we have
to send an error message to the client which might give rise
to another error (if sending the errror message failed). In this
case, ignore the send errror and return the previous error value.

16 years agocom_sender(): Check return value of send_buffer().
Andre Noll [Sun, 20 Jan 2008 13:47:00 +0000 (14:47 +0100)]
com_sender(): Check return value of send_buffer().

16 years agoKill two unnecessary return statements.
Andre Noll [Sun, 20 Jan 2008 13:45:33 +0000 (14:45 +0100)]
Kill two unnecessary return statements.

16 years agodccp_send.c: Reformat comment.
Andre Noll [Sat, 19 Jan 2008 18:28:52 +0000 (19:28 +0100)]
dccp_send.c: Reformat comment.

16 years agomood.c: Kill unrechable return statement.
Andre Noll [Sat, 19 Jan 2008 15:04:07 +0000 (16:04 +0100)]
mood.c: Kill unrechable return statement.

16 years agoAlways check the return value of mark_fd_nonblocking().
Andre Noll [Sat, 19 Jan 2008 14:36:47 +0000 (15:36 +0100)]
Always check the return value of mark_fd_nonblocking().

16 years agodccp_recv.c: Fix a fd leak.
Andre Noll [Sat, 19 Jan 2008 14:02:34 +0000 (15:02 +0100)]
dccp_recv.c: Fix a fd leak.

If shutdown(fd, SHUT_WR) fails, we miss to close the
open fd returned by makesock().

16 years agodccp_recv.c: Reformat comment.
Andre Noll [Sat, 19 Jan 2008 13:57:05 +0000 (14:57 +0100)]
dccp_recv.c: Reformat comment.

16 years agodccp_send.c: Check the return value of mark_fd_nonblocking() also for the client fd.
Andre Noll [Sat, 19 Jan 2008 13:45:14 +0000 (14:45 +0100)]
dccp_send.c: Check the return value of mark_fd_nonblocking() also for the client fd.

16 years agodccp_send: Fix a fd leak.
Andre Noll [Sat, 19 Jan 2008 13:41:15 +0000 (14:41 +0100)]
dccp_send: Fix a fd leak.

If shutdown(fd, SHUT_RD) fails, we miss to close the fd.

16 years agodccp_senc.c: Check return value of mark_fd_nonblocking().
Andre Noll [Sat, 19 Jan 2008 13:37:09 +0000 (14:37 +0100)]
dccp_senc.c: Check return value of mark_fd_nonblocking().

16 years agoAdd __must_check annotation for mark_fd_nonblocking() and mark_fd_blocking().
Andre Noll [Sat, 19 Jan 2008 12:50:27 +0000 (13:50 +0100)]
Add __must_check annotation for mark_fd_nonblocking() and mark_fd_blocking().

16 years agogcc-compat.h: Fix __must_check.
Andre Noll [Sat, 19 Jan 2008 12:24:04 +0000 (13:24 +0100)]
gcc-compat.h: Fix __must_check.

It didn't work for gcc-4.

16 years agoSimplify http_open().
Andre Noll [Sat, 19 Jan 2008 12:09:22 +0000 (13:09 +0100)]
Simplify http_open().

No need to shutdown the clients if listen failed: There
can not possibly exist any connected clients at this point.

16 years agoKill "port" parameter of http_open().
Andre Noll [Sat, 19 Jan 2008 12:07:47 +0000 (13:07 +0100)]
Kill "port" parameter of http_open().

It's always conf.http_port_arg.

16 years agohttp_send.c: Rename server_fd to listen_fd.
Andre Noll [Sat, 19 Jan 2008 12:01:32 +0000 (13:01 +0100)]
http_send.c: Rename server_fd to listen_fd.

To make it consistent with the dccp sender.

16 years agoGet rid of sender->status.
Andre Noll [Sat, 19 Jan 2008 11:57:59 +0000 (12:57 +0100)]
Get rid of sender->status.

DRY: For the http and the dccp sender, the status is given by
the value of the listening fd. For the ortp sender, introduce
the new static int sender_status.

16 years agoRemove unused ortp_pre_select().
Andre Noll [Sat, 19 Jan 2008 11:55:14 +0000 (12:55 +0100)]
Remove unused ortp_pre_select().

16 years agoaft.c: Fix a memory leak in open_and_update_audio_file().
Andre Noll [Thu, 17 Jan 2008 20:59:01 +0000 (21:59 +0100)]
aft.c: Fix a memory leak in open_and_update_audio_file().

If make_status_items() fails, we return an error but
do not free the chunk table buffer.

Also get rid of a pointless "goto err".

16 years agovss.c: Trivial whitespace cleanup.
Andre Noll [Thu, 17 Jan 2008 20:50:36 +0000 (21:50 +0100)]
vss.c: Trivial whitespace cleanup.

16 years agovcc.c: Fix a memory leak in recv_afs_result().
Andre Noll [Thu, 17 Jan 2008 20:50:20 +0000 (21:50 +0100)]
vcc.c: Fix a memory leak in recv_afs_result().

This function contained a code path that allocated
the buffer for the chunk table and then returned an error
(due to a failing fstat()) without freeing the chunk table
buffer.

16 years agonet.c: Fix a memory leak in makesock().
Andre Noll [Thu, 17 Jan 2008 20:40:38 +0000 (21:40 +0100)]
net.c: Fix a memory leak in makesock().

"port" was allocated dynamically but never freed. Fix it by
using a static buffer instead. This buffer can not overflow as
"port_number" is an unsigned short, so its decimal representation
consists of at most 5 digits.

16 years agosend.h: Simplify sender command enum.
Andre Noll [Thu, 17 Jan 2008 19:21:15 +0000 (20:21 +0100)]
send.h: Simplify sender command enum.

Also add GPL header while we're at it.

16 years agoserver.c: Initialize vss _after_ afs.
Andre Noll [Thu, 17 Jan 2008 18:29:23 +0000 (19:29 +0100)]
server.c: Initialize vss _after_ afs.

This way, afs doesn't inherit the open fds of the senders. This fixes

sender http off

Without this patch, para_audiod wouldn't notice that the http sender
has closed its listening fd because afs still has this fd open.

16 years agohttp_send.c: Rename open_tcp_port() to http_open().
Andre Noll [Thu, 17 Jan 2008 18:07:19 +0000 (19:07 +0100)]
http_send.c: Rename open_tcp_port() to http_open().

16 years agoringbuffer improvements.
Andre Noll [Mon, 14 Jan 2008 19:05:24 +0000 (20:05 +0100)]
ringbuffer improvements.

Introduce struct ringbuffer. This allows to get rid of the void* pointers
of the ringbuffer implementation.

16 years agoringbuffer.h: Add GPL header.
Andre Noll [Mon, 14 Jan 2008 18:19:32 +0000 (19:19 +0100)]
ringbuffer.h: Add GPL header.

16 years agoMerge commit 'remotes/meins/master'
Andre Noll [Mon, 14 Jan 2008 09:15:39 +0000 (10:15 +0100)]
Merge commit 'remotes/meins/master'

16 years agoacl.h: Add GPL header and doxygen file comment.
Andre Noll [Sun, 13 Jan 2008 16:27:42 +0000 (17:27 +0100)]
acl.h: Add GPL header and doxygen file comment.

16 years agoAdd pointer to documentation of the new acl functions.
Andre Noll [Sun, 13 Jan 2008 16:16:03 +0000 (17:16 +0100)]
Add pointer to documentation of the new acl functions.

16 years agodoxify acl.c.
Andre Noll [Sun, 13 Jan 2008 16:10:03 +0000 (17:10 +0100)]
doxify acl.c.

16 years agoRename acl functions.
Andre Noll [Sun, 13 Jan 2008 15:46:28 +0000 (16:46 +0100)]
Rename acl functions.

Prefix public functions with acl.

16 years agoMove acl functions to separate file acl.c.
Andre Noll [Sun, 13 Jan 2008 15:41:36 +0000 (16:41 +0100)]
Move acl functions to separate file acl.c.

16 years agohttp_send: Make add_perm_list_entry() and del_perm_list_entry() generic.
Andre Noll [Sun, 13 Jan 2008 15:26:17 +0000 (16:26 +0100)]
http_send: Make add_perm_list_entry() and del_perm_list_entry() generic.

16 years agohttp_send.c: Add get_acl_contents() helper.
Andre Noll [Sun, 13 Jan 2008 15:13:27 +0000 (16:13 +0100)]
http_send.c: Add get_acl_contents() helper.

16 years agohttp_send.c: Make host_in_acl() generic.
Andre Noll [Sun, 13 Jan 2008 15:04:54 +0000 (16:04 +0100)]
http_send.c: Make host_in_acl() generic.

Add an additional parameter for the list head that defines the acl.

16 years agohttp_send.c: Only pass the fd to host_in_access_perm_list().
Andre Noll [Sun, 13 Jan 2008 15:02:39 +0000 (16:02 +0100)]
http_send.c: Only pass the fd to host_in_access_perm_list().

No need to pass a pointer to struct http_client as only its ->fd member
is used. Rename this function to host_in_acl while we're at it.

16 years agohttp_send.c: Make init_access_control_list() generic.
Andre Noll [Sun, 13 Jan 2008 14:58:20 +0000 (15:58 +0100)]
http_send.c: Make init_access_control_list() generic.

16 years agohttp_send: Rename access_perm_list to http_acl.
Andre Noll [Sun, 13 Jan 2008 14:49:51 +0000 (15:49 +0100)]
http_send: Rename access_perm_list to http_acl.

16 years agonew codename, reset version to git
Andre Noll [Sat, 12 Jan 2008 22:23:18 +0000 (23:23 +0100)]
new codename, reset version to git

16 years agothe paraslash-0.3.0 release tarball
Andre Noll [Sat, 12 Jan 2008 22:04:55 +0000 (23:04 +0100)]
the paraslash-0.3.0 release tarball

16 years agoparaslash 0.3.0 v0.3.0
Andre Noll [Sat, 12 Jan 2008 22:03:57 +0000 (23:03 +0100)]
paraslash 0.3.0

16 years agomake all: Also build man pages.
Andre Noll [Sat, 12 Jan 2008 21:26:49 +0000 (22:26 +0100)]
make all: Also build man pages.

Without this patch, man pages are built during make install. It's more
natural to build them at make time.

16 years agomake clean: Remove man dir.
Andre Noll [Sat, 12 Jan 2008 21:05:20 +0000 (22:05 +0100)]
make clean: Remove man dir.

16 years agoINSTALL: Replace "para" by "para_client".
Andre Noll [Fri, 11 Jan 2008 16:06:58 +0000 (17:06 +0100)]
INSTALL: Replace "para" by "para_client".

The para alias is only introduced in README.afs. Reported by
Johannes Wörner.

16 years agoRemove man pages from tarball.
Andre Noll [Fri, 11 Jan 2008 13:15:41 +0000 (14:15 +0100)]
Remove man pages from tarball.

Since they are re-created at make install time anyway and help2man
is now considered a required tool for building paraslash, there is
no reason to ship the pre-generated man pages with the tarball. This
reduces the size of the tarball by about 2k.

Thanks to Johannes Wörner for pointing out this inconsistency.

16 years agoREQUIREMENTS: Move help2man to the list of required software.
Andre Noll [Fri, 11 Jan 2008 13:03:49 +0000 (14:03 +0100)]
REQUIREMENTS: Move help2man to the list of required software.

The man pages depend on the executables, i.e. make rebuilds a man page
whenever the corresponding executable changes. Therefore help2man is
required even when installing from tarballs.

16 years agoREQUIREMENTS: Link to the english version of the linphone pages.
Andre Noll [Fri, 11 Jan 2008 13:01:57 +0000 (14:01 +0100)]
REQUIREMENTS: Link to the english version of the linphone pages.

16 years agofade.c: Don't include curses.h.
Andre Noll [Thu, 10 Jan 2008 09:48:44 +0000 (10:48 +0100)]
fade.c: Don't include curses.h.

para_fade does not depend on curses. Including curses.h leads to an
error at compile time on linux if the curses headers are not installed.

Thanks to Johannes Wörner for reporting.

16 years agoNEWS: Fix a typo.
Andre Noll [Wed, 9 Jan 2008 08:10:35 +0000 (09:10 +0100)]
NEWS: Fix a typo.

16 years agoChange year in Copyright comment from 2007 to 2008.
Andre Noll [Tue, 8 Jan 2008 19:47:06 +0000 (20:47 +0100)]
Change year in Copyright comment from 2007 to 2008.

16 years agoconfigure.ac: Improve alsa checks.
Andre Noll [Mon, 7 Jan 2008 16:50:15 +0000 (17:50 +0100)]
configure.ac: Improve alsa checks.

On non-Linux systems, do not check for alsa, and do not print the
warning message stating that alsa could not be found.

Also, skip further alsa-checks on the first failure.

16 years agoMerge commit 'remotes/yangtse/master'
Andre Noll [Mon, 7 Jan 2008 16:21:21 +0000 (17:21 +0100)]
Merge commit 'remotes/yangtse/master'

16 years agoFix gcc-warning on Solaris.
Andre Noll [Mon, 7 Jan 2008 16:20:49 +0000 (17:20 +0100)]
Fix gcc-warning on Solaris.

net.c:334: warning: missing braces around initializer

16 years agoMerge commit 'remotes/yangtse/master'
Andre Noll [Mon, 7 Jan 2008 15:32:02 +0000 (16:32 +0100)]
Merge commit 'remotes/yangtse/master'

16 years agoFix configure on Solaris.
Andre Noll [Mon, 7 Jan 2008 15:27:31 +0000 (16:27 +0100)]
Fix configure on Solaris.

Without this patch, configure fails on Solaris because it doesn't find
inet_ntoa() and socket(). These are in libnsl and libsocket
respectively, but AC_CHECK_FUNCS() doesn't know this.

16 years agogui.c: Change para command to "para_client --".
Andre Noll [Sun, 6 Jan 2008 13:13:09 +0000 (14:13 +0100)]
gui.c: Change para command to "para_client --".

16 years agoReformat gui.ggo.
Andre Noll [Sun, 6 Jan 2008 13:12:34 +0000 (14:12 +0100)]
Reformat gui.ggo.

16 years agogui.ggo: Kill --auto_decode.
Andre Noll [Sun, 6 Jan 2008 00:47:23 +0000 (01:47 +0100)]
gui.ggo: Kill --auto_decode.

This option is unused for ages..

16 years agocom_ls(): Always print the basename as the subject if -lv was given.
Andre Noll [Sat, 29 Dec 2007 20:44:28 +0000 (21:44 +0100)]
com_ls(): Always print the basename as the subject if -lv was given.

16 years agoFix a doxygen warning.
Andre Noll [Sat, 29 Dec 2007 20:43:50 +0000 (21:43 +0100)]
Fix a doxygen warning.

16 years agoCosmetics.
Andre Noll [Sat, 29 Dec 2007 20:43:36 +0000 (21:43 +0100)]
Cosmetics.

16 years agoSimplify para_basename().
Andre Noll [Sat, 29 Dec 2007 20:43:13 +0000 (21:43 +0100)]
Simplify para_basename().

No need to allocate additional memory. This saves a malloc/free
in the hot path of com_ls(), the only caller. Also take care for
the case basename == NULL.

16 years agoUpdate bash_completion to v0.3 commands.
Andre Noll [Fri, 28 Dec 2007 16:03:02 +0000 (17:03 +0100)]
Update bash_completion to v0.3 commands.

It doesn't care about options, and it's slow.  But it's better than
what was there before.

16 years agoTurn PARA_STRERROR into an inline function.
Andre Noll [Fri, 28 Dec 2007 13:36:10 +0000 (14:36 +0100)]
Turn PARA_STRERROR into an inline function.

Add documentation and an assertion for (num > 0).

16 years agoFix typo in the help text of the ls command.
Andre Noll [Fri, 28 Dec 2007 13:07:04 +0000 (14:07 +0100)]
Fix typo in the help text of the ls command.

16 years agocom_lsatt(): Fix error message.
Andre Noll [Fri, 28 Dec 2007 13:05:53 +0000 (14:05 +0100)]
com_lsatt(): Fix error message.

We must not use PARA_STRERROR(-ret) if ret is zero.

16 years agoMakefile.in: Fix OS detection.
Andre Noll [Fri, 28 Dec 2007 13:02:55 +0000 (14:02 +0100)]
Makefile.in: Fix OS detection.

The uname_s variable was never defined. Define it and rename SYSTEM
to UNAME_RS while we are at it.

16 years agomood.c: Only print log message if we are actually reloading a mood.
Andre Noll [Fri, 28 Dec 2007 12:59:46 +0000 (13:59 +0100)]
mood.c: Only print log message if we are actually reloading a mood.

16 years agoROUND_UP: Add missing parentheses().
Andre Noll [Fri, 28 Dec 2007 12:54:53 +0000 (13:54 +0100)]
ROUND_UP: Add missing parentheses().

16 years agochunk_queue.c: Fix some typos.
Andre Noll [Thu, 27 Dec 2007 22:36:46 +0000 (23:36 +0100)]
chunk_queue.c: Fix some typos.

16 years agoaft.c: Rename save_audio_file_info() and enum aft_row_offsets.
Andre Noll [Thu, 27 Dec 2007 22:15:19 +0000 (23:15 +0100)]
aft.c: Rename save_audio_file_info() and enum aft_row_offsets.

16 years agoaft.c: Improve documentation of the add command.
Andre Noll [Thu, 27 Dec 2007 22:13:23 +0000 (23:13 +0100)]
aft.c: Improve documentation of the add command.

16 years agoserver.ggo: Remove unused selector option.
Andre Noll [Thu, 27 Dec 2007 14:13:40 +0000 (15:13 +0100)]
server.ggo: Remove unused selector option.

16 years agoChange syntax for selecting moods or playlists.
Andre Noll [Thu, 27 Dec 2007 14:13:12 +0000 (15:13 +0100)]
Change syntax for selecting moods or playlists.

Use m/foo, p/bar instead of m:foo and p:bar. This is much friendlier
to bash completion.

16 years agoCosmetics.
Andre Noll [Thu, 27 Dec 2007 14:11:41 +0000 (15:11 +0100)]
Cosmetics.

16 years agoMakefile.in: Change type of variables to simply expanded type.
Andre Noll [Thu, 27 Dec 2007 14:10:58 +0000 (15:10 +0100)]
Makefile.in: Change type of variables to simply expanded type.

16 years agoconfigure.ac: Add some missing checks.
Andre Noll [Sat, 22 Dec 2007 13:55:21 +0000 (14:55 +0100)]
configure.ac: Add some missing checks.

Noted by autoscan.

16 years agoMake client_pre_select() and client_post_select() static.
Andre Noll [Sat, 22 Dec 2007 13:29:02 +0000 (14:29 +0100)]
Make client_pre_select() and client_post_select() static.

Move functions around a bit to avoid forward-declarations.

16 years agoclient_common.c: Trivial cosmetic cleanups.
Andre Noll [Sat, 22 Dec 2007 13:21:43 +0000 (14:21 +0100)]
client_common.c: Trivial cosmetic cleanups.

16 years agoChange default loglevel for para_fsck from 4 to 3.
Andre Noll [Sat, 22 Dec 2007 13:01:16 +0000 (14:01 +0100)]
Change default loglevel for para_fsck from 4 to 3.

16 years agofsck.c: Improve log messages.
Andre Noll [Sat, 22 Dec 2007 13:00:12 +0000 (14:00 +0100)]
fsck.c: Improve log messages.

16 years agofsck.c: Fix NULL-pointer dereference.
Andre Noll [Sat, 22 Dec 2007 12:58:01 +0000 (13:58 +0100)]
fsck.c: Fix NULL-pointer dereference.

fsck_cleanup() might be called with t == NULL.

16 years agofsck.c: Loglevel adjustments.
Andre Noll [Sat, 22 Dec 2007 12:56:43 +0000 (13:56 +0100)]
fsck.c: Loglevel adjustments.

16 years agoclient_common.c: Kill invalid FIXME.
Andre Noll [Sat, 22 Dec 2007 12:54:58 +0000 (13:54 +0100)]
client_common.c: Kill invalid FIXME.

Short writes can not happen here.

16 years agoclient_common.c: Add a comment to client_connect().
Andre Noll [Sat, 22 Dec 2007 12:54:24 +0000 (13:54 +0100)]
client_common.c: Add a comment to client_connect().

16 years agoREADME.afs: Add some information on para_fsck.
Andre Noll [Sat, 22 Dec 2007 12:53:30 +0000 (13:53 +0100)]
README.afs: Add some information on para_fsck.

16 years agoFix para_client hangs.
Andre Noll [Sat, 22 Dec 2007 12:52:51 +0000 (13:52 +0100)]
Fix para_client hangs.

In the client event handler we have to set the eof variable
to a negative value in order to shut down the stdout task.

Rename eof to error while at it.

16 years agoReplace funny statement in para_next_signal() by readable code.
Andre Noll [Tue, 18 Dec 2007 07:19:29 +0000 (08:19 +0100)]
Replace funny statement in para_next_signal() by readable code.

This happened to be correct only by coincidence. Quoting Linus:

Assignments inside tests should probably be relegated entirely
to loop constructs, where doing them outside the test changes
semantics.