|
Message-ID: <20150906170033.GL28959@port70.net> Date: Sun, 6 Sep 2015 19:00:33 +0200 From: Szabolcs Nagy <nsz@...t70.net> To: musl@...ts.openwall.com Subject: Re: process doesn't terminate when closing streams from another thread * Nuno Gon?alves <nunojpg@...il.com> [2015-09-06 15:44:45 +0100]: > I'm having problems when closing streams from another thread. > > The following code: > > static void *func(void *arg) > { > fclose(stdout); > fprintf(stderr,"Thread about to exit\n"); > return 0; > } > > int main(int argc, char **argv) > { > int thread_id; s/int/pthread_t/ > pthread_create(&thread_id,NULL,&func,NULL); > pthread_join(thread_id,NULL); > fprintf(stderr,"Process about to terminate\n"); > return 0; > } > > Prints: > > root@...nWrt:/tmp# ./myapp_withmusl > Thread about to exit > Process about to terminate > > But never returns! I have to send it a SIGINT. > yes, musl fflushes stdout on fflush(0) even if it is closed. (fflush(0) is called at exit, fflushing a closed stream is undefined behaviour). this might be a musl bug.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.