Date: Mon, 10 Aug 1998 21:00:55 +0200 (CEST) From: Stefan Eggers <seggers@semyam.dinoco.de> To: FreeBSD-gnats-submit@FreeBSD.ORG Cc: seggers@semyam.dinoco.de Subject: bin/7560: format string problems in sysinstall Message-ID: <199808101900.VAA05533@semyam.dinoco.de>
next in thread | raw e-mail | index | archive | help
>Number: 7560 >Category: bin >Synopsis: format string problems in sysinstall >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 10 12:10:00 PDT 1998 >Last-Modified: >Originator: Stefan Eggers >Organization: none >Release: FreeBSD 3.0-CURRENT i386 >Environment: -current sources cvsup'ed a few days ago. >Description: While compiling sysinstall I notieced several warnings about format string errors. Turned out they are harmless with gcc on a little endian machine as long as the values printed are small enough and that's probably why nobody noticed a malfunction due to them. The ones in ufs.c are harmless I think but annoying. Adding casts makes them go away. >How-To-Repeat: Try compiling sysinstall. You'll see warnings from gcc about wrong format strings. >Fix: Actually three - one for each affected file. Index: disks.c =================================================================== RCS file: /usr2/FreeBSD/CVSROOT/src/release/sysinstall/disks.c,v retrieving revision 1.98 diff -u -r1.98 disks.c --- disks.c 1998/03/23 08:36:26 1.98 +++ disks.c 1998/08/10 18:41:10 @@ -309,7 +309,7 @@ int size, subtype; chunk_e partitiontype; - snprintf(tmp, 20, "%d", chunk_info[current_chunk]->size); + snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size); val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n" "or append a trailing `M' for megabytes (e.g. 20M)."); if (val && (size = strtol(val, &cp, 0)) > 0) { Index: uc_eisa.c =================================================================== RCS file: /usr2/FreeBSD/CVSROOT/src/release/sysinstall/uc_eisa.c,v retrieving revision 1.4 diff -u -r1.4 uc_eisa.c --- uc_eisa.c 1997/02/22 14:12:26 1.4 +++ uc_eisa.c 1998/08/10 18:54:05 @@ -142,7 +142,7 @@ sizeof(struct eisa_driver)); n=(char *)kv_to_u(kp, (u_int)edrv->name, 20); - asprintf(&epc->device, "%s%d", n, edn->dev.unit); + asprintf(&epc->device, "%s%lu", n, edn->dev.unit); free(n); n=(char *)kv_to_u(kp, (u_int)edn->dev.full_name, 40); /*XXX*/ Index: ufs.c =================================================================== RCS file: /usr2/FreeBSD/CVSROOT/src/release/sysinstall/ufs.c,v retrieving revision 1.12 diff -u -r1.12 ufs.c --- ufs.c 1997/02/22 14:12:35 1.12 +++ ufs.c 1998/08/10 18:45:56 @@ -49,15 +49,15 @@ if (isDebug()) msgDebug("Request for %s from UFS\n", file); - snprintf(buf, PATH_MAX, "%s/%s", dev->private, file); + snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/dists/%s", dev->private, file); + snprintf(buf, PATH_MAX, "%s/dists/%s", (char *)dev->private, file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/%s", dev->private, variable_get(VAR_RELNAME), file); + snprintf(buf, PATH_MAX, "%s/%s/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); if (file_readable(buf)) return fopen(buf, "r"); - snprintf(buf, PATH_MAX, "%s/%s/dists/%s", dev->private, variable_get(VAR_RELNAME), file); + snprintf(buf, PATH_MAX, "%s/%s/dists/%s", (char *)dev->private, variable_get(VAR_RELNAME), file); return fopen(buf, "r"); } >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808101900.VAA05533>