Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.mathworks.com!fu-berlin.de!unlisys!news.bb-data.de!news From: mib@ppe.bb-data.de Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals Subject: Re: Solaris 2.6 Date: 06 Dec 1996 17:57:50 +0100 Organization: BB-DATA GmbH, Berlin, Germany Lines: 31 Sender: mib@LOSIRA Message-ID: <ural3objl.fsf@ppe.bb-data.de> References: <32986299.AC7@mail.esrin.esa.it> <580sgh$kpi@panix2.panix.com> <casper.32a40b7b@mail.fwi.uva.nl> <587jrv$9rf@news.parc.xerox.com> <587meg$h67@web.nmti.com> <5880ig$1a5$1@shade.twinsun.com> <slrn5af88v.199.dave@pc-damir.srce.hr> NNTP-Posting-Host: 10.11.4.39 X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: euryale.cc.adfa.oz.au comp.unix.solaris:91697 comp.unix.bsd.misc:1717 comp.unix.internals:11499 dave@pc-damir.srce.hr (Drazen Kacar) writes: > fstat(fd, &inode) > printf("%d\n", inode.st_size); > > st_size is off_t (64 bits), but %d wants int (32 bits, the same as long). He who writes code like that needs to have his a*s kicked anyway. This has _never_ been legal (at least not since ANSI and POSIX have been here). What _is_ legal is fstat(fd, &inode) printf("%d\n", (int)inode.st_size); , which will work unless the file size is bigger than 2^31. Or fstat(fd, &inode) printf("%ld\n", (long)inode.st_size); , which will only break if a long is not big enough to hold an off_t. But all of this is true regardless of what transition path is chosen. Bad code breaks, sooner or later. That's a fact of life. -- ----------------------------------------------------------------- Dipl.-Inform. Martin Ibert, BB-DATA GmbH, phone: +49-30-245-56582 Brunnenstraße 111, D-13355 Berlin, Germany, fax: +49-30-245-56577 --------------------------------------- mailto:mib@ppe.bb-data.de Disclaimer: "My views don't always reflect those of my employer."