search for: fseek

Displaying 20 results from an estimated 149 matches for "fseek".

Did you mean: lseek
2014 Jun 22
0
[PATCH 5/6] utils/isohybrid.c: Change all fseek(3) to fseeko(3)
It seems unwise to offer future programmers fseek(3) calls for copy+paste. They are simply insufficient for large image files. This change switches all calls of fseek(3) to fseeko(3) and takes care that the offset value if of type off_t. --- utils/isohybrid.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git...
2023 Feb 17
2
fseek/fgetc puzzle
...e file is a newline, and if not, it adds one before writing the new record. I also wrote a regression test for this and in most cases this works fine. On some platforms (Solaris, OpenIndiana and AIX) however, the test fails because it adds two newlines instead of the expected one. Basically if I fseek to the end, read a byte and write a byte the first byte will be duplicated. I reduced it to this test case: #include <stdio.h> int main(void) { FILE *f = fopen("testfile", "w"); putc('A', f); fclose(f); f = fopen("testfile&qu...
2002 Aug 07
2
ftell and fseek
Hi, I'm stumped. How can I do ftell and fseek in R? (Where ftell gives the position in the file and fseek points the file pointer to a given position.) Thanks, Pauline -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info&qu...
2014 May 12
4
[PATCH] isohybrid: fix overflow on 32 bit system
When call isohybrid with option '-u', it overflows on a 32 bits host. It seeks to 512 bytes before the end of the image to install gpt header. If the size of image is larger than LONG_MAX, it overflows fseek() and cause error: isohybrid: wrlinux-image-x86-64-20140505110100.iso: seek error - 8: Invalid argument Check the offset and call fseek() multi-times if offset is too large. Signed-off-by: Kai Kang <kai.kang at windriver.com> --- utils/isohybrid.c | 14 +++++++++++--- 1 file changed, 11 i...
2023 Feb 20
1
fseek/fgetc puzzle
On Mon, Feb 20, 2023 at 10:21:31PM +1100, Darren Tucker wrote: > > My suggestion of course fails to explain why there's only one 'B'. > > I would create the initial file separately from the test program. > > The "od" call in the middle of the above example proves there's only > one byte after the first fclose. Ah, so it does. What happens if you
2023 Feb 20
1
fseek/fgetc puzzle
Darren Tucker wrote in <CALDDTe39k4UFJWBvts5HWbbhHO+Vw9OAP0zBhu-Hje-2aR9+xA at mail.gmail.com>: J?rg Schilling convinced me in 2017 Readd removed fflush()/fseek() in between read and write.. The behave:record_a_resend-2 test failed on Solaris 5.10 and 5.11, messages in *record* where separated by four \n / U+000A instead of two. It turns out that the effective sequence if((fo = Zopen(name, "a+")) == NULL){ if((fo =...
2014 May 13
2
[PATCH] isohybrid: fix overflow on 32 bit system
On 2014?05?12? 22:38, H. Peter Anvin wrote: > That is because it needs to use fseeko() and use off_t. Do you mean it does need a patch for isohybrid.c. And the patch looks like: #if _FILE_OFFSET_BITS == 64 fseeko(...) #else fseek(...) Regards, Kai > > On May 11, 2014 11:53:17 PM PDT, Kang Kai <Kai.Kang at windriver.com> wrote: >> On 2014?05?12? 10:4...
2010 Sep 13
5
isohybrid: seek error - 6: Invalid argument
Hello Recently while playing with bigger iso images (>2G) looks like isohybrid from syslinux-4.02 fails. Sometimes tunning heads/sectors (-h/-s) works, because no padding is needed depending of size of the image. Some debug info provided, if more info is needed please just ask. # isohybrid -v pandereta-2010.09.13-i686.iso catalogue offset: 326 ve[0]: 1, cs: 1 ve[1]: 0, cs: 1 ve[2]: 25927,
2014 May 12
2
[PATCH] isohybrid: fix overflow on 32 bit system
...eter Anvin wrote: > On 05/11/2014 06:56 PM, Kai Kang wrote: >> When call isohybrid with option '-u', it overflows on a 32 bits host. It >> seeks to 512 bytes before the end of the image to install gpt header. If >> the size of image is larger than LONG_MAX, it overflows fseek() and >> cause error: >> >> isohybrid: wrlinux-image-x86-64-20140505110100.iso: seek error - 8: Invalid argument >> >> Check the offset and call fseek() multi-times if offset is too large. >> >> Signed-off-by: Kai Kang <kai.kang at windriver.com> >...
2012 May 29
0
[klibc:master] capabilities: Use fflush() instead of fseek ()
...bc.git;a=commit;h=163920f31f98db13f4e37796bb92f0844e7aaf45 Author: maximilian attems <max at stro.at> AuthorDate: Tue, 29 May 2012 18:58:31 +0200 Committer: maximilian attems <max at stro.at> CommitDate: Tue, 29 May 2012 19:03:08 +0200 [klibc] capabilities: Use fflush() instead of fseek() It shouldn't use stream I/O against a control device at all in do_usermodehelper_file(), as noted by hpa. Stylistically rewind seems cleaner, but fflush() has error checking. Reported-by: H. Peter Anvin <hpa at zytor.com> Signed-off-by: maximilian attems <max at stro.at> --- u...
2014 Jun 20
3
[PATCH] isohybrid: fix overflow on 32 bit system
When call isohybrid with option '-u', it overflows on a 32 bits host. It seeks to 512 bytes before the end of the image to install gpt header. If the size of image is larger than LONG_MAX, it overflows fseek() and cause error: isohybrid: image-x86-64-20140505110100.iso: seek error - 8: Invalid argument Replace fseek with fseeko to fix this issue. Signed-off-by: Kai Kang <kai.kang at windriver.com> --- utils/isohybrid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/...
2013 Dec 01
0
[PATCH v2 4/4] efi: PE file size differ from in-memory size
...ment + * is copied verbatim to the output file. + * Although there may be several LOAD program headers, only + * one is currently copied. */ if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS32) { - const char *shstrtab, *name; - Elf32_Shdr shdr; + Elf32_Phdr phdr; int i; - void *strtab; - - fseek(f_in, shoff, SEEK_SET); - - /* First find the strtab section */ - fseek(f_in, shstrndx * shentsize, SEEK_CUR); - fread(&shdr, sizeof(shdr), 1, f_in); - strtab = malloc(shdr.sh_size); - if (!strtab) { - fprintf(stderr, "Failed to malloc strtab\n"); - exit(EXIT_FAILURE); - }...
2014 Jun 22
16
Announcing a patch series for isohybrid.c
Hi, following will be 6 patch proposals for isohybrid.c 1: Encode GPT partition names as UTF-16LE 2: Correct blocking factor in APM partition block counts 3: Correct end block address of first GPT partition 4: Write GPT backup to the very end of the image 5: Change all fseek(3) to fseeko(3) 6: Introduce option --mbr and make isohybrid.c compilable standalone If the form needs adjustments, i whould be able to reproduce the patches. The state after patch 6 was tested by re-hybdridization of yetserday's Fedora-Live-Desktop-x86_64-20-1.iso. The result was loaded by...
2013 Nov 27
0
[PATCH 4/4] efi: PE file size differ from in-memory size
...ment + * is copied verbatim to the output file. + * Although there may be several LOAD program headers, only + * one is currently copied. */ if (e32_hdr.e_ident[EI_CLASS] == ELFCLASS32) { - const char *shstrtab, *name; - Elf32_Shdr shdr; + Elf32_Phdr phdr; int i; - void *strtab; - - fseek(f_in, shoff, SEEK_SET); - - /* First find the strtab section */ - fseek(f_in, shstrndx * shentsize, SEEK_CUR); - fread(&shdr, sizeof(shdr), 1, f_in); - strtab = malloc(shdr.sh_size); - if (!strtab) { - fprintf(stderr, "Failed to malloc strtab\n"); - exit(EXIT_FAILURE); - }...
2004 Oct 14
3
patch for non-seekable streams on Windows
I've been trying to get oggdec to work with input streamed in through a pipe or a socket. This seems to work on Linux and OS X, but not on Windows. I've found that code in vorbisfile.c tests the input stream for seekability by invoking fseek in the following way: int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR) : -1); Unfortunately, fseek succeeds for a socket on Windows (even though it's not seekable) with the parameters specified. A more definitive test (and one that does work on Windows) is to attempt to seek to the end...
2014 Jun 22
0
isohybrid has 2 variants
...> http://www.syslinux.org/archives/2014-June/022259.html me: > > Already reported in may and diagnosed by hpa: > > http://www.syslinux.org/archives/2014-May/022041.html: > > > The right thing to do is compile it with #define _FILE_OFFSET_BITS 64 > > > and change fseek to fseeko with the appropriate type being off_t. Ady: > This has been already applied in the Syslinux git (zytor repo). The replacement of fseek(3) by fseeko(3) has not happened. Only the sizeof(off_t) has been forced to 64 bit on 32 bit systems in Makefile by CFLAGS = ... -D_FILE_OFFSET_...
2013 Nov 27
20
[PATCH 0/4] efi: PE header generation fix
The PE headers of the generated efi file were quite buggy. And since OVMF perform a few consistency checks, syslinux was unable to run on it. I don't pretend to have a thorough understanding of the PE+ headers, some bugs may remain. :) Celelibi (4): efi: Fix PE header field rva_and_sizes_nr efi: Location, size and alignment of .text section efi: Useless relocations in PE file efi: PE
2002 Feb 05
2
Documentation Suggestions
...ta is signed or unsigned. It would be nice if the comments told you outright that 8-bit PCM data is unsigned, 16-bit is signed (at least, as far as I could find in various specs). -> I spent a long time on linker issues and then crashing before I found one post that mentioned problems with the fseek wrapper in the default callbacks. I set up a callbacks struct to use the standard fopen, fseek, etc, and the problems went away. -> If your music license specifies that the music on your CD must be inaccessible to the average user somehow, you can simply stick your custom header on a .ogg file...
2014 May 13
0
[PATCH] isohybrid: fix overflow on 32 bit system
No #if. On May 12, 2014 6:26:18 PM PDT, Kang Kai <Kai.Kang at windriver.com> wrote: >On 2014?05?12? 22:38, H. Peter Anvin wrote: >> That is because it needs to use fseeko() and use off_t. > >Do you mean it does need a patch for isohybrid.c. And the patch looks >like: > >#if _FILE_OFFSET_BITS == 64 > fseeko(...) >#else > fseek(...) > > >Regards, >Kai > >> >> On May 11, 2014 11:53:17 PM PDT, Kang Kai <Kai.K...
2014 Jun 22
5
isohybrid has 2 variants
...only ones. > > Yeah. It also has problems with large (image) file support. > Already reported in may and diagnosed by hpa: > > http://www.syslinux.org/archives/2014-May/022041.html: > > The right thing to do is compile it with #define _FILE_OFFSET_BITS 64 > > and change fseek to fseeko with the appropriate type being off_t. This has been already applied in the Syslinux git (zytor repo). > > This brings of course the question how to do this on MS-Windows. > > That's why i asked for a DOS exe that can handle 43 bit file byte > addressing (32 bit I...