Download raw body.
pppd(8): cleanup
On Sat, Aug 17, 2024 at 11:21:28AM +0200, Denis Fondras wrote:
> Replace homemade copy_of() with strdup().
> @@ -204,22 +203,6 @@ int vfmtmsg(char *, int, const char *, v
>
> int main(int, char *[]);
>
> -void *
> -dup_mem(void *b, size_t c)
> -{
> - void *ans = malloc (c);
> - if (!ans)
> - fatal(2, "memory error!");
this fatals on allocation failure
> -
> - memcpy (ans, b, c);
> - return ans;
> -}
> -
> -void *copy_of (char *s)
> -{
> - return dup_mem (s, strlen (s) + 1);
> -}
> -
> /*
> * chat [ -v ] [-T number] [-U number] [ -t timeout ] [ -f chat-file ] \
> * [ -r report-file ] \
> @@ -267,7 +250,7 @@ main(int argc, char **argv)
> case 'r':
> if (report_fp != NULL)
> fclose (report_fp);
> - report_file = copy_of (optarg);
> + report_file = strdup(optarg);
so you need an error check here
> report_fp = fopen (report_file, "a");
> if (report_fp != NULL) {
> if (verbose)
>
pppd(8): cleanup