/*****************************************************************************
* file.c
*****************************************************************************
- * Copyright (C) 2001, 2002 the VideoLAN team
+ * Copyright (C) 2001, 2002 VLC authors and VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#include <time.h>
#include <fcntl.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_strings.h>
#include <vlc_dialog.h>
-#if defined( WIN32 ) || defined( __OS2__ )
+#if defined( _WIN32 ) || defined( __OS2__ )
# include <io.h>
#endif
-#ifndef WIN32
+#ifndef _WIN32
# include <unistd.h>
#endif
fd = vlc_dup (fd);
if (fd == -1)
{
- msg_Err (p_access, "cannot use file descriptor: %m");
+ msg_Err (p_access, "cannot use file descriptor: %s",
+ vlc_strerror_c(errno));
return VLC_EGENERIC;
}
}
else
if( !strcmp( p_access->psz_path, "-" ) )
{
-#if defined( WIN32 ) || defined( __OS2__ )
+#if defined( _WIN32 ) || defined( __OS2__ )
setmode (STDOUT_FILENO, O_BINARY);
#endif
fd = vlc_dup (STDOUT_FILENO);
if (fd == -1)
{
- msg_Err (p_access, "cannot use standard output: %m");
+ msg_Err (p_access, "cannot use standard output: %s",
+ vlc_strerror_c(errno));
return VLC_EGENERIC;
}
msg_Dbg( p_access, "using stdout" );
if (fd != -1)
break;
if (fd == -1)
- msg_Err (p_access, "cannot create %s: %m", path);
+ msg_Err (p_access, "cannot create %s: %s", path,
+ vlc_strerror_c(errno));
if (overwrite || errno != EEXIST)
break;
flags &= ~O_EXCL;
break;
}
+ case ACCESS_OUT_CAN_SEEK:
+ {
+ bool *pb = va_arg( args, bool * );
+ struct stat st;
+ if( fstat( (intptr_t)p_access->p_sys, &st ) == -1 )
+ *pb = false;
+ else
+ *pb = S_ISREG( st.st_mode ) || S_ISBLK( st.st_mode );
+ break;
+ }
+
default:
return VLC_EGENERIC;
}
if (errno == EINTR)
continue;
block_ChainRelease (p_buffer);
- msg_Err( p_access, "cannot write: %m" );
+ msg_Err( p_access, "cannot write: %s", vlc_strerror_c(errno) );
return -1;
}