Date: Sat, 8 Jun 1996 18:41:18 +1000 From: Bruce Evans <bde@zeta.org.au> To: rgrimes@gndrsh.aac.dev.com, wpaul@freefall.freebsd.org Cc: CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-gnu@freefall.freebsd.org Subject: Re: cvs commit: src/gnu/usr.bin/ld ld.c Message-ID: <199606080841.SAA27094@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>More ``complete'' fix, use the compiler to do the right thing for you...: >#define TMP_EXTENSION ".tmp" >... > case 'O': > output_filename = malloc(strlen(arg)+sizeof(TMP_EXTENSION)); > strcpy(output_filename, arg); > strcat(output_filename, TMP_EXTENSION); > real_output_filename = arg; > return; I'm not sure if naming the string literal is worth the trouble in this case. There are a few more bugs: - the value returned by malloc() isn't checked. - (style consistency) xmalloc() isn't used. - (style consistency) ld seems to use strcpy(str1 + offset, str2) in preference to strcat() or sprintf(). It should probably use sprintf() except where efficiency is important. - (style) there are no spaces before and after the '+'. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606080841.SAA27094>