diff options
author | Steve Hay <SteveHay@planit.com> | 2005-03-29 08:22:45 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2005-03-29 08:22:45 +0000 |
commit | 58e24efff3e72032a19e2adb55a951735452dbca (patch) | |
tree | 730df36fd67e20d9774cb73a3aec5c66768e70fd /doio.c | |
parent | d94a595083cd516d035cdb88f9587033a47e185e (diff) | |
download | perl-58e24efff3e72032a19e2adb55a951735452dbca.tar.gz |
Fix PerlLIO_chsize() for platforms that don't have chsize()
This is the patch from the end of the thread that started here:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-09/msg00055.html
p4raw-id: //depot/perl@24092
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1242,14 +1242,15 @@ Perl_do_binmode(pTHX_ PerlIO *fp, int iotype, int mode) return PerlIO_binmode(aTHX_ fp, iotype, mode, name); } -#if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP) - /* code courtesy of William Kucharski */ -#define HAS_CHSIZE - +#if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) I32 my_chsize(fd, length) I32 fd; /* file descriptor */ Off_t length; /* length to set file to */ { +#ifdef F_FREESP + /* code courtesy of William Kucharski */ +#define HAS_CHSIZE + struct flock fl; Stat_t filebuf; @@ -1290,8 +1291,12 @@ Off_t length; /* length to set file to */ } return 0; -} +#else + dTHX; + DIE(aTHX_ "truncate not implemented"); #endif /* F_FREESP */ +} +#endif /* !HAS_TRUNCATE && !HAS_CHSIZE */ bool Perl_do_print(pTHX_ register SV *sv, PerlIO *fp) |