--- mpg123~/httpget.c 2000-10-30 17:45:12 +0000 +++ mpg123/httpget.c 2003-09-25 16:04:38 +0000 @@ -50,12 +50,11 @@ void writestring (int fd, char *string) void readstring (char *string, int maxlen, FILE *f) { -#if 0 char *result; -#endif +#if 0 int pos = 0; - while(1) { + while(maxlen>pos) { if( read(fileno(f),string+pos,1) == 1) { pos++; if(string[pos-1] == '\n') { @@ -68,7 +67,7 @@ void readstring (char *string, int maxle exit(1); } } -#if 0 +#endif do { result = fgets(string, maxlen, f); } while (!result && errno == EINTR); @@ -76,7 +75,6 @@ void readstring (char *string, int maxle fprintf (stderr, "Error reading from socket or unexpected EOF.\n"); exit (1); } -#endif }