From: Gene Cumm <gene.cumm at gmail.com> linux/syslinux.c: Silence warnings from GCC with asprintf's attribute warn_unused_result in certain glibc versions/patches. Assign it to a variable and ignore it as the string is already tested for null before using it. Signed-off-by: Gene Cumm <gene.cumm at gmail.com> --- diff --git a/libinstaller/setadv.c b/libinstaller/setadv.c index c891b87..e9847e7 100644 --- a/libinstaller/setadv.c +++ b/libinstaller/setadv.c @@ -182,8 +182,9 @@ int read_adv(const char *path, const char *cfg) int fd = -1; struct stat st; int err = 0; + int ret; - asprintf(&file, "%s%s%s", + ret = asprintf(&file, "%s%s%s", path, path[0] && path[strlen(path) - 1] == '/' ? "" : "/", cfg); if (!file) { diff --git a/linux/syslinux.c b/linux/syslinux.c index 888df3d..3a51f7e 100644 --- a/linux/syslinux.c +++ b/linux/syslinux.c @@ -276,12 +276,13 @@ int main(int argc, char *argv[]) int mnt_cookie; int patch_sectors; int i; + int ret; mypid = getpid(); umask(077); parse_options(argc, argv, MODE_SYSLINUX); - asprintf(&subdir, "%s%s", + ret = asprintf(&subdir, "%s%s", opt.directory[0] == '/' ? "" : "/", opt.directory); if (!subdir) { perror(program);
H. Peter Anvin
2010-Jun-20 00:01 UTC
[syslinux] [PATCH 1/2] linux/syslinux.c: Silence warnings
On 06/19/2010 05:11 AM, Gene Cumm wrote:> From: Gene Cumm<gene.cumm at gmail.com> > > linux/syslinux.c: Silence warnings from GCC with asprintf's attribute > warn_unused_result in certain glibc versions/patches. Assign it to a > variable and ignore it as the string is already tested for null before > using it. > > Signed-off-by: Gene Cumm<gene.cumm at gmail.com> >Okay, what *blithering idiot* put warn_unused_result on *asprintf*?!!!! -hpa
Seemingly Similar Threads
- [PATCH] Wedding gift, removing double l from auxilliary
- [PATCH 2/2] linux/syslinux.c: Test if null
- [PATCH 5/5] installers: fix a MinGW redefinition warning
- [PATCH] mtools/syslinux.c: Silence warnings
- [PATCH 1/3] ALPHA: make sector size dynamic in extlinux