--- icecast-1.3/shout/shout.c Fri Jul 16 03:42:51 1999 +++ icecast-1.3-hack/shout/shout.c Wed Mar 15 09:10:58 2000 @@ -128,6 +128,28 @@ WSADATA wsaData; #endif +int copy_file (char *ftarg, char *fsrc) +{ + FILE *fptarg, *fpsrc; + char c; + + fptarg = fopen(ftarg, "w"); + if (fptarg == NULL) return 1; + fpsrc = fopen(fsrc, "r"); + if (fpsrc == NULL) { + fclose(fptarg); + return 1; + } + while (1) { + c = getc(fpsrc); + if (c != EOF) fputc(c, fptarg); + else break; + } + fclose (fptarg); + fclose (fpsrc); + return 0; +} + int main (int argc, char **argv) { @@ -820,6 +842,19 @@ remove (set.playlist); #endif + if (copy_file(set.playlist, tmp_name)) { + scream (TOERROR, "Could not copy %s to %s, exiting.\n", tmp_name, + set.playlist); + perror ("rename"); + px_shutdown (15); + } + unlink(tmp_name); + free(tmp_name); + set.playlist_index = 0; + + /* Something is going wrong in this commented-out code: shout + segfaults on reshuffling the play list. I used "copy_file" + instead. Allin Cottrell 3/15/2000 if (rename (tmp_name, set.playlist) < 0) { scream (TOERROR, "Could not rename %s to %s, exiting.\n", tmp_name, @@ -829,8 +864,9 @@ } set.playlist_index = 0; remove (tmp_name); - nfree (tmp_name); - fclose (tmp); + nfree (tmp_name); + fclose (tmp); */ + scream (VERBOSE, "Done shuffling..\n"); } @@ -1121,7 +1157,10 @@ } -#ifndef _WIN32 +#ifdef MESSUP /* Was ifndef _WIN32, but this fork stuff doesn't work + properly on my system: fills up the process table + with "defunct" shout processes + Allin Cottrell, 3/15/2000 */ if (set.titlestreaming) { int icepid = fork ();