search for: fclose

Displaying 20 results from an estimated 787 matches for "fclose".

Did you mean: close
2009 Aug 12
1
[PATCH libguestfs] fish: don't read freed memory
...5E26: rc_remote (rc.c:269) ==11953== by 0x413C53: issue_command (fish.c:779) ==11953== by 0x414F81: main (fish.c:721) ==11953== Address 0x4e602e8 is 0 bytes inside a block of size 568 free'd ==11953== at 0x4A0633D: free (vg_replace_malloc.c:323) ==11953== by 0x3E89C660DC: fclose@@GLIBC_2.2.5 (in /lib64/libc-2.10.1.so) ==11953== by 0x415E10: rc_remote (rc.c:268) ==11953== by 0x413C53: issue_command (fish.c:779) ==11953== by 0x414F81: main (fish.c:721) ==11953== ==11953== Invalid read of size 8 ==11953== at 0x3E89C66543: fflush (in /lib64/libc-2.10.1....
2011 Aug 27
1
[PATCH 1/3] Fix file descriptor leak
...t a/common/common.c b/common/common.c index f443cb7..e8004d7 100644 --- a/common/common.c +++ b/common/common.c @@ -244,6 +244,7 @@ int sendsignalfn(const char *pidfn, int sig) if (fgets(buf, sizeof(buf), pidf) == NULL) { upslogx(LOG_NOTICE, "Failed to read pid from %s", pidfn); + fclose(pidf); return -1; } @@ -251,6 +252,7 @@ int sendsignalfn(const char *pidfn, int sig) if (pid < 2) { upslogx(LOG_NOTICE, "Ignoring invalid pid number %d", pid); + fclose(pidf); return -1; } @@ -259,6 +261,7 @@ int sendsignalfn(const char *pidfn, int sig) if (r...
2024 Feb 15
1
certain pipe() use cases not working in r-devel
...Lines("hello", x <- pipe("cat")); close(x)' ...skip... write(5, "hello\n", 6) = -1 EBADF (Bad file descriptor) exit_group(0) = ? +++ exited with 0 +++ There is a comment saying "see timeout_wait for why not to use fclose", which I think references a different function, R_pclose_timeout(): >> Do not use fclose, because on Solaris it sets errno to "Invalid >> seek" when the pipe is already closed (e.g. because of timeout). >> fclose would not return an error, but it would set errno a...
2017 Mar 06
7
[PATCH 0/6] Various Coverity fixes #2
Hi, this patch series fixes few more issues discovered by Coverity. Thanks, Pino Toscano (6): tail: check the return value pf guestfs_set_pgroup daemon: btrfs: check end_stringsbuf return values everywhere java: use cleanup handlers for structs (lists) as return values lib: qemu: improve handling of FILE* p2v: check more return values p2v: fix possible close(-1) issue cat/tail.c
2016 Nov 13
1
Memory leak with tons of closed connections
Using dup() before fdopen() (and calling fclose() on the connection when it is closed) indeed fixes the memory leak. FYI, Gabor Index: src/main/connections.c =================================================================== --- src/main/connections.c (revision 71653) +++ src/main/connections.c (working copy) @@ -576,7 +576,7 @@ fp = R_f...
2005 Oct 17
6
Error Executing sampledec in VC++
...&spxbits, pcm); // Copy 1 frame from float pcm to short spx for (n=0; n<FRAME_SIZE; n++) spx [n] = pcm [n]; fwrite (spx, sizeof(short), FRAME_SIZE, fs); } // end of loop // Entire file has been read, decoded and saved speex_decoder_destroy (decstate); speex_bits_destroy (&spxbits); fclose (fo); fclose (fs); cout << "Finished processing!\n"; } On 10/18/05, Steve Russell <srussell@innernet.net> wrote: > > Mon, > Here is feedback that I got concerning the access violation, i.e. the > failure of the while loop below. Does this solve the problem? >...
2007 Apr 02
1
Problems with stereo data
..._int(Frame, FrameSize, &Bits); speex_encode_int(State, Frame, &Bits); short BytesToWrite = speex_bits_write(&Bits, Cbits, 200); fwrite(&BytesToWrite, sizeof(short), 1, fout); fwrite(Cbits, 1, BytesToWrite, fout); } speex_encoder_destroy(State); speex_bits_destroy(&Bits); fclose(fout); fclose(fin); } // Decoder #include <stdio.h> #include <speex/speex.h> #include <speex/speex_stereo.h> #pragma comment(lib, "libspeex.lib") int main(int argc, char* argv[]) { FILE* fin = fopen(argv[1], "rb"); FILE* fout = fopen(argv[2], "wb...
2003 Nov 05
1
First AGI help..
...open("php://stderr","w"); $in = fopen("php://stdin","r"); $out = fopen("php://stdout","w"); //This works.. fputs($out, "Verbose \"Calling phone"\n"); // This doesn't fputs($out, "exec(Dial(sip/2012)\n"); fclose($in); fclose($out); fclose($err); ?> test2.pl script.. #!/usr/bin/perl # taken from a sample file.. $|=1; while(<STDIN>) { chomp; last unless length($_); if (/^agi_(\w+)\:\s+(.*)$/) { $AGI{$1} = $2; } } #This works.. print STDOUT "AG...
2016 May 12
0
[PATCH 4/4] lib: qemu: Memoize qemu feature detection.
...test results of %s, in %s", + g->hv, cachedir); + + fp = fopen (qemu_stat_filename, "r"); + if (fp == NULL) + goto do_test; + if (fscanf (fp, "%d %" SCNu64 " %" SCNu64, + &generation, &prev_size, &prev_mtime) != 3) { + fclose (fp); + goto do_test; + } + fclose (fp); + + if (generation == MEMO_GENERATION && + (uint64_t) statbuf.st_size == prev_size && + (uint64_t) statbuf.st_mtime == prev_mtime) { + /* Same binary as before, so read the previously cached qemu -help + * and qemu -dev...
2004 Feb 11
1
Problem using 'ov_open()'...
...l OpenOGG(char*); pSOUNDDATA DecodeOGGLow(); void CloseOGG(pSOUNDDATA); private: FILE *pFile; OggVorbis_File *pOVFile; }; OGGDATA::OGGDATA() { pFile = NULL; pOVFile = NULL; } OGGDATA::~OGGDATA() { if(pOVFile != NULL) ov_clear(pOVFile); if(pFile != NULL) fclose(pFile); } bool OGGDATA::OpenOGG(char *Filename) { int Result; if(pOVFile != NULL) ov_clear(pOVFile); if(pFile != NULL) fclose(pFile); if((pFile = fopen(Filename, "rb")) == NULL) return false; Result = ov_open(pFile, pOVFile, NULL, 0); switch(Result) {...
2013 Sep 03
1
[PATCH v2] tftp-hpa: add error check for disk filled up
...s *pf, struct tftphdr *oap, int oac syslog(LOG_WARNING, "tftpd: write(ack): %m"); goto abort; } - write_behind(file, pf->f_convert); + if(write_behind(file, pf->f_convert) < 0) { + nak(ENOSPACE, NULL); + (void)fclose(file); + goto abort; + } for (;;) { n = recv_time(peer, dp, PKTSIZE, 0, &r_timeout); if (n < 0) { /* really? */ @@ -1712,7 +1716,11 @@ static void tftp_recvfile(const struct formats *pf, struct tftphdr *oap, int oac got...
2005 Oct 17
3
Error Executing sampledec in VC++
...&spxbits, pcm); // Copy 1 frame from float pcm to short spx for (n=0; n<FRAME_SIZE; n++) spx [n] = pcm [n]; fwrite (spx, sizeof(short), FRAME_SIZE, fs); } // end of loop // Entire file has been read, decoded and saved speex_decoder_destroy (decstate); speex_bits_destroy (&spxbits); fclose (fo); fclose (fs); cout << "Finished processing!\n"; } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20051017/4fea1d86/attachment.html
2006 Aug 15
2
Windows build with Visual Studio 2005 - some success
...y test_all.rb Loaded suite test_all Started ........F.....E................./unit/../unit/analysis/../../unit/document/../../unit/index/tc_index _reader.rb:539: [BUG] Segmentation fault ruby 1.8.4 (2006-04-14) [i386-mswin32] I have managed to trace this to the following line in fs_store.c:201: if (fclose((FILE *)os->file)) For some reason, fclose() segfaults. It also segfaults when closing the file when it was just opened, it segfaults when I add some test code: FILE * f2; f2 = fopen("c:\\test.txt", "wb"); fprintf(f2, "testing..."); printf("closing\n");...
2006 Dec 18
2
AGI Help Please
...ELECT * FROM cdr WHERE dst = '$clid' "; $query_result1 = @mysql_query($query1); $row_count = mysql_num_rows($query_result1); $row1 = @mysql_fetch_array ($query_result1); fputs($stdout,"There have been\n"); fputs($stdout,"$row_count calls made\n"); fflush($stdout); fclose($stdin); fclose($stdout); exit; ?> There are no debug errors and the query is going through just fine... and yes, I chmod 755. Does anyone have a clue what I am doing wrong? Thanks, bp -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipe...
2008 Oct 11
1
[PATCH] fstype: Fix ext4/ext4dev probing
...mp;& !isspace(*cp)) + cp++; + } + while (*cp && isspace(*cp)) + cp++; + if ((t = strchr(cp, '\n')) != NULL) + *t = 0; + if ((t = strchr(cp, '\t')) != NULL) + *t = 0; + if ((t = strchr(cp, ' ')) != NULL) + *t = 0; + if (!strcmp(fs_name, cp)) { + fclose(f); + return (1); + } + } + fclose(f); + return (0); +} + +/* + * Check to see if a filesystem is available as a module + * Returns 1 if found, 0 if not + */ +static int check_for_modules(const char *fs_name) +{ + struct utsname uts; + FILE *f; + char buf[1024], *cp, *t; + int i; + + if (unam...
2010 Mar 03
2
uint decode error on visual studio...
...1; } else { if(fwrite(encodedbuffer,bytes_per_packet,sizeof(unsigned char),encodedfile)!=1) { printf("ERROR: failed writing bytes to %s\n",encodedfilename); return -1; } else { printf("writing offset: %d, size %d\n",offset,bytes_per_packet); offset+=bytes_per_packet; } } } fclose(inputfile); fclose(encodedfile); celt_encoder_destroy(encoder); celt_mode_destroy(mode); CELTMode* mode2=celt_mode_create(gSampleRate,gFrameSize,&error); if(mode2==NULL || error!=CELT_OK) { printf("ERROR: celt_mode_create 2 %s\n",celt_strerror(error)); return -1; } encodedfile=f...
2006 Oct 02
1
Omindex.cc BSD bug
...forks (sh: fork temporarily unavailable) making the system unusable and probably skipping documents. I'm using MAC Osx Server 10.4.3 (Darwin/BSD) and GCC 4.0. The problem: On function stdout_to_string a popen is called, but is not closed properly (according the popen manual) because is using fclose instead of pclose and hence processes created by popen are not killed. Solution: Omindex.cc line 201, replace fclose by pclose : If (pclose(sh) == -1) throw read ReadError(); This must correct the problem, I'm not sure if will cause the same error in other platforms or UNIX. Cheers
2002 Nov 04
4
making --exclude-from=- read from stdin
...; + } + else { + f= fopen(fname,"r"); + } if (!f) { if (fatal) { rsyserr(FERROR, errno, @@ -243,7 +250,9 @@ add_exclude_list(line,&list,include); } } - fclose(f); + if( ! (fname[0]=='-' && fname[1]=='\0' )) { + fclose(f); + } return list; }
2004 Dec 15
1
[LLVMdev] FileUtilities.cpp error: `close' undeclared
...es.cpp for Debug build c:/projects/src/llvm-1/llvm/lib/Support/FileUtilities.cpp: In destructor `llvm::FDHandle::~FDHandle()': c:/projects/src/llvm-1/llvm/lib/Support/FileUtilities.cpp:79: error: `close' undeclared (first use this function) ---------------- Shouldn't function close be fclose declared from <stdio.h> while we deal with file descriptors? Henrik. ============================================================= Henrik Bach Open Source Developer e-mail: henrik_bach_llvm at hotmail.com ============================================================= Got Freedom? Softwar...
2002 Dec 09
2
ov_open/ov_test weirdness
...ndicates a bug or heap/stack corruption."; break; default: tmp = "Unknown error"; break; } fprintf(stderr, "error: %s\n", tmp); return -1; } ov_clear(&vf); fclose(f); fprintf(stderr, "Ok1\n"); f = fopen(argv[1], "rb"); if(!f) { fprintf(stderr, "fopen for '%s' failed: %s", file, strerror(errno)); return -1; } err = ov_open(f, &v...