Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2009 16:36:20 GMT
From:      Javier Villavicencio <the_paya@gentoo.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/131880: printf("%zi", (ssize_t) -1) prints 4294967292 (unsigned) value instead of -1
Message-ID:  <200902191636.n1JGaKUw090269@www.freebsd.org>
Resent-Message-ID: <200902191640.n1JGe4Ip097089@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         131880
>Category:       misc
>Synopsis:       printf("%zi", (ssize_t) -1) prints 4294967292 (unsigned) value instead of -1
>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:   Thu Feb 19 16:40:04 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Javier Villavicencio
>Release:        7.1-RELEASE
>Organization:
Gentoo
>Environment:
FreeBSD  7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan  1 14:37:25 UTC 2009     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Argument for %zi (or %zd) printf format is treated as unsigned while it should be signed.

See also:
http://mail-index.netbsd.org/current-users/2009/02/19/msg008168.html
>How-To-Repeat:
Testcase:

#include <stdio.h>
#include <sys/types.h>

int main(int argc, char **argv)
{
    printf("%zi\n", (ssize_t)-argc);
    return 0;
}

>Fix:
Perhaps http://mail-index.netbsd.org/current-users/2009/02/19/msg008168.html

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902191636.n1JGaKUw090269>