- close();
- if (d_fp){
- fclose((FILE *) d_fp);
- d_fp = 0;
- }
-}
-
-bool
-gr_file_sink::open(const char *filename)
-{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
-
- // we use the open system call to get access to the O_LARGEFILE flag.
- int fd;
- if ((fd = ::open (filename,
- O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY, 0664)) < 0){
- perror (filename);
- return false;
- }
-
- if (d_new_fp){ // if we've already got a new one open, close it
- fclose((FILE *) d_new_fp);
- d_new_fp = 0;
- }
-
- if ((d_new_fp = fdopen (fd, "wb")) == NULL){
- perror (filename);
- ::close(fd); // don't leak file descriptor if fdopen fails.
- }
-
- d_updated = true;
- return d_new_fp != 0;
-}
-
-void
-gr_file_sink::close()
-{
- omni_mutex_lock l(d_mutex); // hold mutex for duration of this function
-
- if (d_new_fp){
- fclose((FILE *) d_new_fp);
- d_new_fp = 0;
- }
- d_updated = true;