Use vlc_close()

This commit is contained in:
Rémi Denis-Courmont 2016-04-22 00:11:43 +03:00
parent 582355f965
commit 8f2e1e57cf
46 changed files with 127 additions and 115 deletions

View File

@ -140,7 +140,9 @@ VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const char *psz_fmt,
# define SHUT_WR 1
# define SHUT_RDWR 2
# endif
# define net_Close( fd ) (void)close (fd)
VLC_API int vlc_close(int);
# define net_Close( fd ) (void)vlc_close (fd)
#endif
/* Portable network names/addresses resolution layer */

View File

@ -610,7 +610,7 @@ static int probeFile(const char *psz_name)
ret = VLC_SUCCESS;
bailout:
close(fd);
vlc_close(fd);
return ret;
}

View File

@ -28,6 +28,7 @@
#include <vlc_common.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <errno.h>
#include <time.h>
@ -2625,6 +2626,6 @@ void en50221_End( cam_t * p_cam )
}
}
close( p_cam->fd );
vlc_close( p_cam->fd );
free( p_cam );
}

View File

@ -215,7 +215,7 @@ dvb_device_t *dvb_open (vlc_object_t *obj)
{
msg_Err (obj, "cannot access demultiplexer: %s",
vlc_strerror_c(errno));
close (d->dir);
vlc_close (d->dir);
free (d);
return NULL;
}
@ -249,7 +249,7 @@ dvb_device_t *dvb_open (vlc_object_t *obj)
if (d->demux == -1)
{
msg_Err (obj, "cannot access DVR: %s", vlc_strerror_c(errno));
close (d->dir);
vlc_close (d->dir);
free (d);
return NULL;
}
@ -261,7 +261,7 @@ dvb_device_t *dvb_open (vlc_object_t *obj)
{
d->cam = en50221_Init (obj, ca);
if (d->cam == NULL)
close (ca);
vlc_close (ca);
}
else
msg_Dbg (obj, "conditional access module not available: %s",
@ -280,15 +280,15 @@ void dvb_close (dvb_device_t *d)
{
for (size_t i = 0; i < MAX_PIDS; i++)
if (d->pids[i].fd != -1)
close (d->pids[i].fd);
vlc_close (d->pids[i].fd);
}
#endif
if (d->cam != NULL)
en50221_End (d->cam);
if (d->frontend != -1)
close (d->frontend);
close (d->demux);
close (d->dir);
vlc_close (d->frontend);
vlc_close (d->demux);
vlc_close (d->dir);
free (d);
}
@ -406,7 +406,7 @@ int dvb_add_pid (dvb_device_t *d, uint16_t pid)
param.flags = DMX_IMMEDIATE_START;
if (ioctl (fd, DMX_SET_PES_FILTER, &param) < 0)
{
close (fd);
vlc_close (fd);
goto error;
}
d->pids[i].fd = fd;
@ -433,7 +433,7 @@ void dvb_remove_pid (dvb_device_t *d, uint16_t pid)
{
if (d->pids[i].pid == pid)
{
close (d->pids[i].fd);
vlc_close (d->pids[i].fd);
d->pids[i].pid = d->pids[i].fd = -1;
return;
}

View File

@ -110,7 +110,7 @@ int FrontendOpen( access_t *p_access )
if( FrontendInfo( p_access ) < 0 )
{
close( p_sys->i_frontend_handle );
vlc_close( p_sys->i_frontend_handle );
free( p_frontend );
return VLC_EGENERIC;
}
@ -165,7 +165,7 @@ int FrontendOpen( access_t *p_access )
{
msg_Err( p_access, "requested type %s not supported by %s tuner",
psz_expected, psz_real );
close( p_sys->i_frontend_handle );
vlc_close( p_sys->i_frontend_handle );
free( p_frontend );
return VLC_EGENERIC;
}
@ -202,7 +202,7 @@ void FrontendClose( access_t *p_access )
if( p_sys->p_frontend )
{
close( p_sys->i_frontend_handle );
vlc_close( p_sys->i_frontend_handle );
free( p_sys->p_frontend );
p_sys->p_frontend = NULL;
@ -1216,7 +1216,7 @@ int DMXUnsetFilter( access_t * p_access, int i_fd )
}
msg_Dbg( p_access, "DMXUnsetFilter: closing demux %d", i_fd );
close( i_fd );
vlc_close( i_fd );
return VLC_SUCCESS;
}
@ -1268,5 +1268,5 @@ void DVRClose( access_t * p_access )
{
access_sys_t *p_sys = p_access->p_sys;
close( p_sys->i_handle );
vlc_close( p_sys->i_handle );
}

View File

@ -1608,6 +1608,6 @@ static int ProbeDVD( const char *psz_name )
&& GetWLE( &anchor ) == 2 )
ret = VLC_SUCCESS; /* Found a potential anchor */
bailout:
close( fd );
vlc_close( fd );
return ret;
}

View File

@ -180,7 +180,7 @@ static int Open(vlc_object_t *p_this)
if (bind(publicSock, (struct sockaddr *)&publicAddr, sizeof(struct sockaddr_un)) == -1) {
msg_Err(p_access, "bind local socket failed (errno=%d)", errno);
close(publicSock);
vlc_close(publicSock);
free(p_sys);
return VLC_EGENERIC;
}
@ -188,7 +188,7 @@ static int Open(vlc_object_t *p_this)
/* we are not expecting more than one connection */
if (listen(publicSock, 1) == -1) {
msg_Err(p_access, "cannot accept connection (errno=%d)", errno);
close(publicSock);
vlc_close(publicSock);
free(p_sys);
return VLC_EGENERIC;
} else {
@ -207,7 +207,7 @@ static int Open(vlc_object_t *p_this)
peerSock = accept(publicSock, (struct sockaddr *)&peerAddr, &peerSockLen);
if (peerSock == -1) {
msg_Err(p_access, "cannot wait for connection (errno=%d)", errno);
close(publicSock);
vlc_close(publicSock);
free(p_sys);
return VLC_EGENERIC;
}
@ -217,7 +217,7 @@ static int Open(vlc_object_t *p_this)
p_sys->eyetvSock = peerSock;
/* remove public access */
close(publicSock);
vlc_close(publicSock);
unlink(publicAddr.sun_path);
}
return VLC_SUCCESS;
@ -241,7 +241,7 @@ static void Close(vlc_object_t *p_this)
TRUE);
msg_Dbg(p_access, "plugin notified");
close(p_sys->eyetvSock);
vlc_close(p_sys->eyetvSock);
msg_Dbg(p_access, "msg port closed and freed");
free(p_sys);

View File

@ -249,7 +249,7 @@ int FileOpen( vlc_object_t *p_this )
return VLC_SUCCESS;
error:
close (fd);
vlc_close (fd);
return VLC_EGENERIC;
}
@ -268,7 +268,7 @@ void FileClose (vlc_object_t * p_this)
access_sys_t *p_sys = p_access->p_sys;
close (p_sys->fd);
vlc_close (p_sys->fd);
free (p_sys);
}

View File

@ -76,7 +76,7 @@ static void conn_destroy(void)
{
conn_shutdown(SHUT_WR);
vlc_http_conn_release(conn);
close(external_fd);
vlc_close(external_fd);
}
static struct vlc_http_stream *stream_open(void)

View File

@ -113,7 +113,7 @@ static void conn_destroy(void)
{
shutdown(external_fd, SHUT_WR);
vlc_http_conn_release(conn);
close(external_fd);
vlc_close(external_fd);
}
static struct vlc_http_stream *stream_open(void)

View File

@ -98,7 +98,7 @@ static void *proxy_thread(void *data)
int canc = vlc_savecancel();
proxy_client_process(cfd);
close(cfd);
vlc_close(cfd);
connection_count++;
vlc_restorecancel(canc);
}
@ -123,7 +123,7 @@ static int server_socket(unsigned *port)
if (bind(fd, (struct sockaddr *)&addr, addrlen)
|| getsockname(fd, (struct sockaddr *)&addr, &addrlen))
{
close(fd);
vlc_close(fd);
return -1;
}
@ -157,7 +157,7 @@ int main(void)
if (listen(lfd, 255))
{
close(lfd);
vlc_close(lfd);
return 77;
}
@ -173,5 +173,5 @@ int main(void)
vlc_join(th, NULL);
assert(connection_count > 0);
free(url);
close(lfd);
vlc_close(lfd);
}

View File

@ -253,7 +253,7 @@ static int Open( vlc_object_t *p_this )
if( pthread_create( &p_sys->thread, NULL, Demux, p_demux ) )
{
close( p_sys->evfd );
vlc_close( p_sys->evfd );
goto error;
}
@ -275,7 +275,7 @@ static void Close( vlc_object_t *p_this )
write( p_sys->evfd, &(uint64_t){ 1 }, sizeof (uint64_t));
pthread_join( p_sys->thread, NULL );
close( p_sys->evfd );
vlc_close( p_sys->evfd );
free( p_sys );
}
@ -667,7 +667,7 @@ static ssize_t WriteULSysfs( const char *psz_fmt, unsigned int i_link,
return i_fd;
i_ret = write( i_fd, psz_data, strlen(psz_data) + 1 );
close( i_fd );
vlc_close( i_fd );
return i_ret;
}
@ -727,7 +727,7 @@ static int InitCapture( demux_t *p_demux )
if( pfd[1].revents )
{
close( p_sys->i_vfd );
vlc_close( p_sys->i_vfd );
return VLC_EGENERIC;
}
}
@ -737,10 +737,10 @@ static int InitCapture( demux_t *p_demux )
{
msg_Warn( p_demux, "couldn't SDIVIDEO_IOC_RXGETVIDSTATUS: %s",
vlc_strerror_c(errno) );
close( p_sys->i_vfd );
vlc_close( p_sys->i_vfd );
return VLC_EGENERIC;
}
close( p_sys->i_vfd );
vlc_close( p_sys->i_vfd );
if ( InitVideo( p_demux ) != VLC_SUCCESS )
return VLC_EGENERIC;
@ -789,7 +789,7 @@ static int InitCapture( demux_t *p_demux )
msg_Err( p_demux, "unknown sample rate %u", i_rate );
return VLC_EGENERIC;
}
close( p_sys->i_afd );
vlc_close( p_sys->i_afd );
if ( InitAudio( p_demux ) != VLC_SUCCESS )
return VLC_EGENERIC;
@ -925,7 +925,7 @@ static void CloseCapture( demux_t *p_demux )
munmap( p_sys->pp_vbuffers[i], p_sys->i_vbuffer_size );
free( p_sys->pp_vbuffers );
#endif
close( p_sys->i_vfd );
vlc_close( p_sys->i_vfd );
if ( p_sys->i_max_channel != -1 )
{
#ifdef HAVE_MMAP_SDIAUDIO
@ -933,7 +933,7 @@ static void CloseCapture( demux_t *p_demux )
munmap( p_sys->pp_abuffers[i], p_sys->i_abuffer_size );
free( p_sys->pp_abuffers );
#endif
close( p_sys->i_afd );
vlc_close( p_sys->i_afd );
}
}

View File

@ -1765,7 +1765,7 @@ static void CloseCapture( demux_t *p_demux )
StopDecode( p_demux );
for ( unsigned int i = 0; i < p_sys->i_buffers; i++ )
munmap( p_sys->pp_buffers[i], p_sys->i_buffer_size );
close( p_sys->i_fd );
vlc_close( p_sys->i_fd );
free( p_sys->pp_buffers );
}

View File

@ -164,7 +164,7 @@ static void Close( vlc_object_t * p_this )
access_t *p_access = ( access_t* )p_this;
access_sys_t *p_sys = p_access->p_sys;
close ( p_sys->fd );
vlc_close ( p_sys->fd );
if( vlc_unlink( p_access->psz_filepath ) != 0 )
msg_Err( p_access, "Error deleting file %s, %s",
p_access->psz_filepath, vlc_strerror_c(errno) );

View File

@ -192,7 +192,8 @@ static void DemuxClose( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( p_sys->i_fd >= 0 ) close( p_sys->i_fd );
if( p_sys->i_fd >= 0 )
vlc_close( p_sys->i_fd );
if( p_sys->p_block ) block_Release( p_sys->p_block );
free( p_sys );
@ -376,7 +377,8 @@ static int OpenAudioDevOss( demux_t *p_demux )
adev_fail:
if( i_fd >= 0 ) close( i_fd );
if( i_fd >= 0 )
vlc_close( i_fd );
return -1;
}
@ -432,11 +434,13 @@ static bool ProbeAudioDevOss( demux_t *p_demux, const char *psz_device )
goto open_failed;
}
if( i_fd >= 0 ) close( i_fd );
if( i_fd >= 0 )
vlc_close( i_fd );
return true;
open_failed:
if( i_fd >= 0 ) close( i_fd );
if( i_fd >= 0 )
vöc_close( i_fd );
return false;
}

View File

@ -219,7 +219,7 @@ static block_t *Shoot(demux_t *demux)
}
out:
close(fd);
vlc_close(fd);
return block;
}

View File

@ -341,7 +341,7 @@ static void DemuxFile (void *data)
static void CloseFile (demux_sys_t *sys)
{
close (sys->fd);
vlc_close (sys->fd);
}
#ifdef HAVE_SYS_SHM_H

View File

@ -72,7 +72,7 @@ vlc_v4l2_vbi_t *OpenVBI (demux_t *demux, const char *psz_device)
{
msg_Err (demux, "cannot capture VBI data: %s", errstr);
free (errstr);
close (rawfd);
vlc_close (rawfd);
goto err;
}
@ -155,7 +155,7 @@ void GrabVBI (demux_t *p_demux, vlc_v4l2_vbi_t *vbi)
void CloseVBI (vlc_v4l2_vbi_t *vbi)
{
close (vbi_capture_fd (vbi->cap));
vlc_close (vbi_capture_fd (vbi->cap));
vbi_capture_delete (vbi->cap);
free (vbi);
}

View File

@ -248,7 +248,7 @@ void ioctl_Close( vlc_object_t * p_this, vcddev_t *p_vcddev )
DosClose( p_vcddev->hcd );
#else
if( p_vcddev->i_device_handle != -1 )
close( p_vcddev->i_device_handle );
vlc_close( p_vcddev->i_device_handle );
#endif
free( p_vcddev );
}
@ -919,7 +919,7 @@ static void CloseVCDImage( vlc_object_t * p_this, vcddev_t *p_vcddev )
{
VLC_UNUSED( p_this );
if( p_vcddev->i_vcdimage_handle != -1 )
close( p_vcddev->i_vcdimage_handle );
vlc_close( p_vcddev->i_vcdimage_handle );
else
return;

View File

@ -215,7 +215,7 @@ static void Close( vlc_object_t * p_this )
access_sys_t *p_sys = p_access->p_sys;
if( p_sys->fd != -1 )
close( p_sys->fd );
vlc_close( p_sys->fd );
ARRAY_RESET( p_sys->file_sizes );
if( p_sys->p_meta )
@ -504,7 +504,7 @@ static bool SwitchFile( access_t *p_access, unsigned i_file )
/* close old file */
if( p_sys->fd != -1 )
{
close( p_sys->fd );
vlc_close( p_sys->fd );
p_sys->fd = -1;
}
@ -545,7 +545,7 @@ error:
" open the file \"%s\" (%s)."), psz_path, vlc_strerror(errno) );
if( p_sys->fd != -1 )
{
close( p_sys->fd );
vlc_close( p_sys->fd );
p_sys->fd = -1;
}
free( psz_path );

View File

@ -334,7 +334,7 @@ static int Open( vlc_object_t *p_this )
if (fstat (fd, &st))
{
msg_Err (p_access, "write error: %s", vlc_strerror_c(errno));
close (fd);
vlc_close (fd);
return VLC_EGENERIC;
}
@ -374,7 +374,7 @@ static void Close( vlc_object_t * p_this )
{
sout_access_out_t *p_access = (sout_access_out_t*)p_this;
close( (intptr_t)p_access->p_sys );
vlc_close( (intptr_t)p_access->p_sys );
msg_Dbg( p_access, "file access output closed" );
}

View File

@ -355,7 +355,7 @@ static int CryptSetup( sout_access_out_t *p_access, char *key_file )
ssize_t keylen = read( keyfd, key, 16 );
close( keyfd );
vlc_close( keyfd );
if( keylen < 16 )
{
msg_Err( p_access, "No key at least 16 octects (you provided %zd), no encryption", keylen );
@ -732,7 +732,7 @@ static void closeCurrentSegment( sout_access_out_t *p_access, sout_access_out_sy
}
close( p_sys->i_handle );
vlc_close( p_sys->i_handle );
p_sys->i_handle = -1;
if( ! ( us_asprintf( &segment->psz_duration, "%.2f", p_sys->f_seglen ) ) )

View File

@ -237,7 +237,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
sys->format = *fmt;
return VLC_SUCCESS;
error:
close (fd);
vlc_close (fd);
return VLC_EGENERIC;
}
@ -313,7 +313,7 @@ static void Stop (audio_output_t *aout)
int fd = sys->fd;
ioctl (fd, SNDCTL_DSP_HALT, NULL);
close (fd);
vlc_close (fd);
sys->fd = -1;
}
@ -356,7 +356,7 @@ static int DevicesEnum (audio_output_t *aout)
n++;
}
out:
close (fd);
vlc_close (fd);
return n;
}

View File

@ -204,7 +204,7 @@ static void Delete( vlc_va_t *va, AVCodecContext *avctx )
XCloseDisplay( sys->p_display_x11 );
#endif
#ifdef VLC_VA_BACKEND_DRM
close( sys->drm_fd );
vlc_close( sys->drm_fd );
#endif
free( sys );
}
@ -478,7 +478,7 @@ error:
#endif
#ifdef VLC_VA_BACKEND_DRM
if( sys->drm_fd != -1 )
close( sys->drm_fd );
vlc_close( sys->drm_fd );
#endif
free( sys );
return VLC_EGENERIC;

View File

@ -182,8 +182,8 @@ static int Open( vlc_object_t *p_this )
msg_Err( p_this, "Failed to connect to the D-Bus session daemon: %s",
error.message );
dbus_error_free( &error );
close( p_sys->p_pipe_fds[1] );
close( p_sys->p_pipe_fds[0] );
vlc_close( p_sys->p_pipe_fds[1] );
vlc_close( p_sys->p_pipe_fds[0] );
free( p_sys );
return VLC_EGENERIC;
}
@ -280,8 +280,8 @@ error:
vlc_mutex_destroy( &p_sys->lock );
close( p_sys->p_pipe_fds[1] );
close( p_sys->p_pipe_fds[0] );
vlc_close( p_sys->p_pipe_fds[1] );
vlc_close( p_sys->p_pipe_fds[0] );
free( p_sys );
return VLC_ENOMEM;
}
@ -333,8 +333,8 @@ static void Close ( vlc_object_t *p_this )
vlc_array_destroy( p_sys->p_events );
vlc_array_destroy( p_sys->p_timeouts );
vlc_array_destroy( p_sys->p_watches );
close( p_sys->p_pipe_fds[1] );
close( p_sys->p_pipe_fds[0] );
vlc_close( p_sys->p_pipe_fds[1] );
vlc_close( p_sys->p_pipe_fds[0] );
free( p_sys );
}

View File

@ -167,10 +167,10 @@ static int intf_Eject( vlc_object_t *p_this, const char *psz_device )
# endif
{
msg_Err( p_this, "could not eject %s", psz_device );
close( fd );
vlc_close( fd );
return VLC_EGENERIC;
}
close( fd );
vlc_close( fd );
return VLC_SUCCESS;
#else

View File

@ -529,7 +529,7 @@ int tar_open( TAR **t, char *pathname, int oflags )
if( f == NULL )
{
fprintf( stderr, "Couldn't gzopen %s\n", pathname );
close( fd );
vlc_close( fd );
return -1;
}
@ -775,7 +775,7 @@ int gzopen_frontend( const char *pathname, int oflags, int mode )
if( !gzf )
{
errno = ENOMEM;
close( fd );
vlc_close( fd );
return -1;
}

View File

@ -38,6 +38,7 @@
#ifdef HAVE_ALSA
# include <vlc_modules.h>
#endif
#include <vlc_fs.h>
#include <vlc_url.h>
static int OpenV4L (vlc_object_t *);
@ -535,9 +536,9 @@ static char *disc_get_mrl (struct udev_device *dev)
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_STATE");
if (val == NULL)
{ /* Force probing of the disc in the drive if any. */
int fd = open (node, O_RDONLY|O_CLOEXEC);
int fd = vlc_open (node, O_RDONLY);
if (fd != -1)
close (fd);
vlc_close (fd);
return NULL;
}
if (!strcmp (val, "blank"))

View File

@ -178,7 +178,7 @@ static void *Thread (void *data)
msg_Dbg (stream, "compressed stream at EOF");
/* Let child process know about EOF */
p_sys->write_fd = -1;
close (fd);
vlc_close (fd);
return NULL;
}
@ -327,13 +327,13 @@ static int Open (stream_t *stream, const char *path)
ret = VLC_SUCCESS;
}
#endif /* _POSIX_SPAWN < 0 */
close (uncomp[1]);
vlc_close (uncomp[1]);
if (ret != VLC_SUCCESS)
close (uncomp[0]);
vlc_close (uncomp[0]);
}
close (comp[0]);
vlc_close (comp[0]);
if (ret != VLC_SUCCESS)
close (comp[1]);
vlc_close (comp[1]);
}
if (ret != VLC_SUCCESS)
@ -363,11 +363,11 @@ static void Close (vlc_object_t *obj)
int status;
vlc_cancel (p_sys->thread);
close (p_sys->read_fd);
vlc_close (p_sys->read_fd);
vlc_join (p_sys->thread, NULL);
if (p_sys->write_fd != -1)
/* Killed before EOF? */
close (p_sys->write_fd);
vlc_close (p_sys->write_fd);
msg_Dbg (obj, "waiting for PID %u", (unsigned)p_sys->pid);
while (waitpid (p_sys->pid, &status, 0) == -1);

View File

@ -499,10 +499,10 @@ static int Open(vlc_object_t *obj)
|| mmap(sys->buffer + sys->buffer_size, sys->buffer_size,
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd, 0) == MAP_FAILED)
{
close(fd);
vlc_close(fd);
goto error;
}
close(fd);
vlc_close(fd);
#elif defined(__OS2__)
/* On OS/2 Warp, page size is 4K, but the smallest chunk size is 64K */
int page_size = 64 * 1024;

View File

@ -217,7 +217,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
msg_Warn( p_filter, "Error on input file: %s",
vlc_strerror_c(errno) );
close( p_sys->i_inputfd );
vlc_close( p_sys->i_inputfd );
p_sys->i_inputfd = -1;
}
}
@ -324,7 +324,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
msg_Warn( p_filter, "Error on output file: %s",
vlc_strerror_c(errno) );
close( p_sys->i_outputfd );
vlc_close( p_sys->i_outputfd );
p_sys->i_outputfd = -1;
}
}

View File

@ -516,7 +516,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
/* Get framebuffer device information */
if (ioctl(sys->fd, FBIOGET_VSCREENINFO, &sys->var_info)) {
msg_Err(vd, "cannot get fb info (%s)", vlc_strerror_c(errno));
close(sys->fd);
vlc_close(sys->fd);
return VLC_EGENERIC;
}
sys->old_info = sys->var_info;
@ -535,7 +535,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
if (ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->var_info)) {
msg_Err(vd, "cannot set fb info (%s)", vlc_strerror_c(errno));
close(sys->fd);
vlc_close(sys->fd);
return VLC_EGENERIC;
}
@ -549,7 +549,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
/* Restore fb config */
ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
close(sys->fd);
vlc_close(sys->fd);
return VLC_EGENERIC;
}
@ -584,7 +584,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
/* Restore fb config */
ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
close(sys->fd);
vlc_close(sys->fd);
return VLC_ENOMEM;
}
sys->fb_cmap.start = 0;
@ -620,7 +620,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
/* Restore fb config */
ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
close(sys->fd);
vlc_close(sys->fd);
return VLC_EGENERIC;
}
@ -641,7 +641,7 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
/* Restore fb config */
ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
close(sys->fd);
vlc_close(sys->fd);
return VLC_EGENERIC;
}
@ -678,7 +678,7 @@ static void CloseDisplay(vout_display_t *vd)
ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
/* Close fb */
close(sys->fd);
vlc_close(sys->fd);
}
}

View File

@ -124,7 +124,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
if (ftruncate(fd, length))
{
msg_Err(vd, "cannot allocate buffers: %s", vlc_strerror_c(errno));
close(fd);
vlc_close(fd);
return NULL;
}
@ -132,7 +132,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
if (base == MAP_FAILED)
{
msg_Err(vd, "cannot map buffers: %s", vlc_strerror_c(errno));
close(fd);
vlc_close(fd);
return NULL;
}
#ifndef NDEBUG
@ -140,7 +140,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
#endif
struct wl_shm_pool *shm_pool = wl_shm_create_pool(sys->shm, fd, length);
close(fd);
vlc_close(fd);
if (shm_pool == NULL)
{
munmap(base, length);

View File

@ -397,7 +397,7 @@ int config_SaveConfigFile (vlc_object_t *p_this)
msg_Err (p_this, "cannot create configuration file: %s",
vlc_strerror_c(errno));
vlc_rwlock_unlock (&config_lock);
close (fd);
vlc_close (fd);
vlc_mutex_unlock (&lock);
goto error;
}

View File

@ -1110,7 +1110,7 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
p_storage->p_filew = fdopen( fd, "w+b" );
if( p_storage->p_filew == NULL )
{
close( fd );
vlc_close( fd );
vlc_unlink( psz_file );
goto error;
}

View File

@ -543,13 +543,13 @@ static int ExecuteLoad( vlm_t *p_vlm, const char *psz_path, vlm_message_t **pp_s
|| read( fd, psz_buffer, st.st_size ) < (ssize_t)st.st_size )
{
free( psz_buffer );
close( fd );
vlc_close( fd );
*pp_status = vlm_MessageNew( "load", "Read file error" );
return VLC_EGENERIC;
}
close( fd );
vlc_close( fd );
psz_buffer[st.st_size] = '\0';

View File

@ -442,6 +442,7 @@ us_atof
us_strtod
us_strtof
us_vasprintf
vlc_close
vlc_fopen
utf8_fprintf
vlc_loaddir

View File

@ -488,6 +488,6 @@ block_t *block_FilePath (const char *path)
return NULL;
block_t *block = block_File (fd);
close (fd);
vlc_close (fd);
return block;
}

View File

@ -365,8 +365,8 @@ static void vlc_poll_i11e_cleanup(void *opaque)
vlc_interrupt_finish(ctx);
if (fd[1] != fd[0])
close(fd[1]);
close(fd[0]);
vlc_close(fd[1]);
vlc_close(fd[0]);
}
static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
@ -426,8 +426,8 @@ static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
canc = vlc_savecancel();
if (fd[1] != fd[0])
close(fd[1]);
close(fd[0]);
vlc_close(fd[1]);
vlc_close(fd[0]);
vlc_restorecancel(canc);
return ret;
}

View File

@ -77,7 +77,7 @@ char *vlc_getProxyUrl(const char *url)
posix_spawnattr_destroy(&attr);
posix_spawn_file_actions_destroy(&actions);
close(fd[1]);
vlc_close(fd[1]);
if (pid != -1)
{
@ -93,7 +93,7 @@ char *vlc_getProxyUrl(const char *url)
}
while (len < sizeof (buf));
close(fd[0]);
vlc_close(fd[0]);
while (waitpid(pid, &(int){ 0 }, 0) == -1);
if (len >= 9 && !strncasecmp(buf, "direct://", 9))
@ -108,7 +108,7 @@ char *vlc_getProxyUrl(const char *url)
/* Parse error: fallback (may be due to missing executable) */
}
else
close(fd[0]);
vlc_close(fd[0]);
/* Fallback to environment variable */
char *var = getenv("http_proxy");

View File

@ -70,7 +70,7 @@ static void vlc_rand_init (void)
ikey[i] = key[i] ^ 0x36;
}
close (fd);
vlc_close (fd);
}

View File

@ -93,7 +93,7 @@ FILE *vlc_fopen (const char *filename, const char *mode)
FILE *stream = fdopen (fd, mode);
if (stream == NULL)
close (fd);
vlc_close (fd);
return stream;
}

View File

@ -29,6 +29,7 @@
#include <fcntl.h>
#include <vlc_threads.h>
#include <vlc_fs.h>
static void media_parse_ended(const libvlc_event_t *event, void *user_data)
{
@ -217,7 +218,7 @@ static void test_media_subitems(int argc, const char** argv)
assert (media != NULL);
test_media_subitems_media (media, true, true);
libvlc_media_release (media);
close (fd);
vlc_close (fd);
#else
#warning not testing subitems list via a fd location
#endif

View File

@ -29,6 +29,7 @@
#include <vlc_plugin.h>
#include <vlc_modules.h>
#include <vlc_interrupt.h>
#include <vlc_fs.h>
#include <vlc_keystore.h>
#undef NDEBUG
@ -335,7 +336,7 @@ main(int i_argc, char *ppsz_argv[])
if (i_tmp_fd != -1)
{
close(i_tmp_fd);
vlc_close(i_tmp_fd);
unlink(psz_tmp_path);
}
free(ppsz_vlc_argv[0]);

View File

@ -132,7 +132,7 @@ static int securepair(vlc_thread_t *th, vlc_tls_t **restrict client,
alpnv[1], alp);
if (*client == NULL)
{
val = close(insecurev[1]);
val = vlc_close(insecurev[1]);
assert(val == 0);
vlc_join(*th, NULL);
return -1;

View File

@ -31,6 +31,7 @@
#include <vlc_keystore.h>
#include <vlc_dialog.h>
#include <vlc_url.h>
#include <vlc_fs.h>
#undef NDEBUG
#include <assert.h>
@ -330,7 +331,7 @@ main(void)
}
libvlc_release(p_libvlc);
close(i_tmp_fd);
vlc_close(i_tmp_fd);
return 0;
}