--- cyrus-imapd-2.5.7/imap/sync_client.c.orig 2016-05-22 00:56:24.302742893 +0000 +++ cyrus-imapd-2.5.7/imap/sync_client.c 2016-05-22 10:25:34.956598506 +0000 @@ -2621,6 +2621,10 @@ /* Check for shutdown file */ if (sync_shutdown_file && !stat(sync_shutdown_file, &sbuf)) { unlink(sync_shutdown_file); + /* Have to exit with r == 0 or do_daemon() will call us again. + * The value of r is unknown from calls to sync_log_reader_begin() below. + */ + r = 0; break; }