apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: cvs commit: apr/test testnames.c
Date Mon, 09 Apr 2001 15:03:51 GMT

> >   gets is an unsafe function, and it outputs and error message on Linux.
> >   Using fgets makes this compile quietly.
> >
> >   -        if (!gets(rootpath))
> >   +        if (!fgets(rootpath, 256, stdin))
> >                exit(0);
> >            fprintf(stdout, "Enter an add path$ ");
> >   -        if (!gets(addpath))
> >   +        if (!fgets(addpath, 256, stdin))
> >                exit(0);
>
> Fair enough ... however, don't you need to eat the newline with this patch?
>
> stroff = strlen(path) - 1;
> while (stroff >= path && apr_isspace(stroff)) {
>     path[stroff--] = '\0';
> }

Probably.  I didn't think of that problem.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message