mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
Merge remote branch 'mco/1780_remove_errno_decl'
* mco/1780_remove_errno_decl: Removed calls to strerror() function from own libsamba implementation. Removing calls of strerror() function in mc-core Ticket #1780: removing own declaration of errno and strerror()
This commit is contained in:
commit
09e2003c1e
@ -164,7 +164,7 @@ AC_CHECK_FUNCS([\
|
||||
initgroups isascii \
|
||||
memcpy memset \
|
||||
putenv \
|
||||
setreuid statfs strerror sysconf \
|
||||
setreuid statfs sysconf \
|
||||
tcgetattr tcsetattr truncate \
|
||||
])
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h> /* strerror() */
|
||||
#include <errno.h> /* extern int errno */
|
||||
|
||||
|
||||
@ -68,7 +67,7 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
|
||||
fd = mc_open (ini_path, O_WRONLY | O_TRUNC | O_SYNC, 0);
|
||||
if (fd == -1) {
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, "%s", strerror(errno)));
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, unix_error_string (errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -80,7 +79,7 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path,
|
||||
|
||||
if (cur_written == -1) {
|
||||
mc_util_restore_from_backup_if_possible (ini_path, "~");
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, "%s", strerror(errno)));
|
||||
g_propagate_error (error, g_error_new (mc_main_error_quark() ,0, unix_error_string (errno)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -720,17 +720,13 @@ const char *
|
||||
unix_error_string (int error_num)
|
||||
{
|
||||
static char buffer [BUF_LARGE];
|
||||
#if GLIB_MAJOR_VERSION >= 2
|
||||
gchar *strerror_currentlocale;
|
||||
|
||||
|
||||
strerror_currentlocale = g_locale_from_utf8(g_strerror (error_num), -1, NULL, NULL, NULL);
|
||||
g_snprintf (buffer, sizeof (buffer), "%s (%d)",
|
||||
strerror_currentlocale, error_num);
|
||||
g_free(strerror_currentlocale);
|
||||
#else
|
||||
g_snprintf (buffer, sizeof (buffer), "%s (%d)",
|
||||
g_strerror (error_num), error_num);
|
||||
#endif
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ mcview_hexedit_save_changes (mcview_t * view)
|
||||
}
|
||||
|
||||
if (mc_close (fp) == -1) {
|
||||
error = g_strdup (strerror (errno));
|
||||
error = g_strdup (unix_error_string (errno));
|
||||
message (D_ERROR, _(" Save file "),
|
||||
_(" Error while closing the file: \n %s \n"
|
||||
" Data may have been written or not. "), error);
|
||||
@ -291,7 +291,7 @@ mcview_hexedit_save_changes (mcview_t * view)
|
||||
return TRUE;
|
||||
|
||||
save_error:
|
||||
error = g_strdup (strerror (errno));
|
||||
error = g_strdup (unix_error_string (errno));
|
||||
text = g_strdup_printf (_(" Cannot save file: \n %s "), error);
|
||||
g_free (error);
|
||||
(void) mc_close (fp);
|
||||
|
@ -78,13 +78,6 @@ AC_CHECK_TYPE(ssize_t, int)
|
||||
# we need libdl for PAM and the new VFS code
|
||||
AC_CHECK_LIB(dl,main)
|
||||
|
||||
AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
|
||||
AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
|
||||
samba_cv_errno=yes,samba_cv_have_errno=no)])
|
||||
if test x"$samba_cv_errno" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define if errno is declared])
|
||||
fi
|
||||
|
||||
# stupid glibc has the functions but no declaration. grrrr.
|
||||
AC_CACHE_CHECK([for crypt declaration],samba_cv_have_crypt_decl,[
|
||||
AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)crypt],
|
||||
@ -138,7 +131,7 @@ if test x"$ac_cv_func_connect" = x"no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(waitpid getcwd strtoul strerror chown chmod)
|
||||
AC_CHECK_FUNCS(waitpid getcwd strtoul chown chmod)
|
||||
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync memset)
|
||||
AC_CHECK_FUNCS(memmove vsnprintf snprintf setsid glob pipe crypt16 getauthuid)
|
||||
AC_CHECK_FUNCS(sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent)
|
||||
|
@ -454,20 +454,11 @@
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
extern char *sys_errlist[];
|
||||
#define strerror(i) sys_errlist[i]
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCHR
|
||||
# define strchr index
|
||||
# define strrchr rindex
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ERRNO_DECL
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BROKEN_GETGROUPS
|
||||
#define GID_T int
|
||||
#else
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define CHARSET_C
|
||||
#include "includes.h"
|
||||
|
||||
const char *unix_error_string (int error_num);
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
/*
|
||||
@ -238,14 +239,14 @@ code page file (size=%d).\n", codepage_file_name, (int)size));
|
||||
if((fp = sys_fopen( codepage_file_name, "r")) == NULL)
|
||||
{
|
||||
DEBUG(0,("load_client_codepage: cannot open file %s. Error was %s\n",
|
||||
codepage_file_name, strerror(errno)));
|
||||
codepage_file_name, unix_error_string (errno)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(fread( buf, 1, CODEPAGE_HEADER_SIZE, fp)!=CODEPAGE_HEADER_SIZE)
|
||||
{
|
||||
DEBUG(0,("load_client_codepage: cannot read header from file %s. Error was %s\n",
|
||||
codepage_file_name, strerror(errno)));
|
||||
codepage_file_name, unix_error_string (errno)));
|
||||
goto clean_and_exit;
|
||||
}
|
||||
|
||||
@ -298,7 +299,7 @@ multiple of 4.\n", codepage_file_name));
|
||||
if(fread( (char *)cp_p, 1, size, fp)!=size)
|
||||
{
|
||||
DEBUG(0,("load_client_codepage: read fail on file %s. Error was %s.\n",
|
||||
codepage_file_name, strerror(errno)));
|
||||
codepage_file_name, unix_error_string (errno)));
|
||||
goto clean_and_exit;
|
||||
}
|
||||
|
||||
|
@ -2607,7 +2607,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
|
||||
}
|
||||
|
||||
if (errno != 0)
|
||||
DEBUG(3,("fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
|
||||
DEBUG(3,("fcntl lock gave errno %d (%s)\n",errno, unix_error_string(errno)));
|
||||
|
||||
/* a lock query */
|
||||
if (op == SMB_F_GETLK)
|
||||
@ -2629,7 +2629,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
|
||||
if (ret == -1)
|
||||
{
|
||||
DEBUG(3,("lock failed at offset %.0f count %.0f op %d type %d (%s)\n",
|
||||
(double)offset,(double)count,op,type,strerror(errno)));
|
||||
(double)offset,(double)count,op,type, unix_error_string (errno)));
|
||||
|
||||
/* perhaps it doesn't support this sort of locking?? */
|
||||
if (errno == EINVAL)
|
||||
@ -2859,7 +2859,7 @@ int set_maxfiles(int requested_max)
|
||||
|
||||
if(getrlimit(RLIMIT_NOFILE, &rlp)) {
|
||||
DEBUG(0,("set_maxfiles: getrlimit (1) for RLIMIT_NOFILE failed with error %s\n",
|
||||
strerror(errno) ));
|
||||
unix_error_string (errno) ));
|
||||
/* just guess... */
|
||||
return requested_max;
|
||||
}
|
||||
@ -2877,14 +2877,14 @@ int set_maxfiles(int requested_max)
|
||||
|
||||
if(setrlimit(RLIMIT_NOFILE, &rlp)) {
|
||||
DEBUG(0,("set_maxfiles: setrlimit for RLIMIT_NOFILE for %d files failed with error %s\n",
|
||||
(int)rlp.rlim_cur, strerror(errno) ));
|
||||
(int)rlp.rlim_cur, unix_error_string (errno) ));
|
||||
/* just guess... */
|
||||
return saved_current_limit;
|
||||
}
|
||||
|
||||
if(getrlimit(RLIMIT_NOFILE, &rlp)) {
|
||||
DEBUG(0,("set_maxfiles: getrlimit (2) for RLIMIT_NOFILE failed with error %s\n",
|
||||
strerror(errno) ));
|
||||
unix_error_string (errno) ));
|
||||
/* just guess... */
|
||||
return saved_current_limit;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ BOOL file_lock(int fd, int type, int secs, int *plock_depth)
|
||||
{
|
||||
if (!do_file_lock(fd, secs, type)) {
|
||||
DEBUG(10,("file_lock: locking file failed, error = %s.\n",
|
||||
strerror(errno)));
|
||||
unix_error_string (errno)));
|
||||
return False;
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ BOOL file_unlock(int fd, int *plock_depth)
|
||||
|
||||
if(!ret)
|
||||
DEBUG(10,("file_unlock: unlocking file failed, error = %s.\n",
|
||||
strerror(errno)));
|
||||
unix_error_string (errno)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
const char *unix_error_string (int error_num);
|
||||
|
||||
#ifdef WITH_SSL
|
||||
#include <ssl.h>
|
||||
#undef Realloc /* SSLeay defines this and samba has a function of this name */
|
||||
@ -189,7 +191,7 @@ ssize_t write_socket(int fd,char *buf,size_t len)
|
||||
DEBUG(6,("write_socket(%d,%d) wrote %d\n",fd,(int)len,(int)ret));
|
||||
if(ret <= 0)
|
||||
DEBUG(1,("write_socket: Error writing %d bytes to socket %d: ERRNO = %s\n",
|
||||
(int)len, fd, strerror(errno) ));
|
||||
(int)len, fd, unix_error_string (errno) ));
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@ -208,7 +210,7 @@ ssize_t read_udp_socket(int fd,char *buf,size_t len)
|
||||
memset((char *)&lastip,'\0',sizeof(lastip));
|
||||
ret = (ssize_t)recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen);
|
||||
if (ret <= 0) {
|
||||
DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
|
||||
DEBUG(2,("read socket failed. ERRNO=%s\n", unix_error_string (errno)));
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -264,7 +266,7 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
|
||||
}
|
||||
|
||||
if (readret == -1) {
|
||||
DEBUG(0,("read_with_timeout: read error = %s.\n", strerror(errno) ));
|
||||
DEBUG(0,("read_with_timeout: read error = %s.\n", unix_error_string (errno) ));
|
||||
smb_read_error = READ_ERROR;
|
||||
return -1;
|
||||
}
|
||||
@ -293,7 +295,7 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
|
||||
/* Check if error */
|
||||
if(selrtn == -1) {
|
||||
/* something is wrong. Maybe the socket is dead? */
|
||||
DEBUG(0,("read_with_timeout: timeout read. select error = %s.\n", strerror(errno) ));
|
||||
DEBUG(0,("read_with_timeout: timeout read. select error = %s.\n", unix_error_string (errno) ));
|
||||
smb_read_error = READ_ERROR;
|
||||
return -1;
|
||||
}
|
||||
@ -324,7 +326,7 @@ ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned
|
||||
|
||||
if (readret == -1) {
|
||||
/* the descriptor is probably dead */
|
||||
DEBUG(0,("read_with_timeout: timeout read. read error = %s.\n", strerror(errno) ));
|
||||
DEBUG(0,("read_with_timeout: timeout read. read error = %s.\n", unix_error_string (errno) ));
|
||||
smb_read_error = READ_ERROR;
|
||||
return -1;
|
||||
}
|
||||
@ -376,13 +378,13 @@ ssize_t read_data(int fd,char *buffer,size_t N)
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
DEBUG(10,("read_data: read of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
|
||||
DEBUG(10,("read_data: read of %d returned 0. Error = %s\n", (int)(N - total), unix_error_string (errno) ));
|
||||
smb_read_error = READ_EOF;
|
||||
return 0;
|
||||
}
|
||||
if (ret == -1)
|
||||
{
|
||||
DEBUG(0,("read_data: read failure for %d. Error = %s\n", (int)(N - total), strerror(errno) ));
|
||||
DEBUG(0,("read_data: read failure for %d. Error = %s\n", (int)(N - total), unix_error_string (errno) ));
|
||||
smb_read_error = READ_ERROR;
|
||||
return -1;
|
||||
}
|
||||
@ -413,7 +415,7 @@ ssize_t write_data(int fd,char *buffer,size_t N)
|
||||
#endif /* WITH_SSL */
|
||||
|
||||
if (ret == -1) {
|
||||
DEBUG(1,("write_data: write failure. Error = %s\n", strerror(errno) ));
|
||||
DEBUG(1,("write_data: write failure. Error = %s\n", unix_error_string (errno) ));
|
||||
return -1;
|
||||
}
|
||||
if (ret == 0) return total;
|
||||
@ -651,7 +653,7 @@ BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type)
|
||||
|
||||
if (!ret)
|
||||
DEBUG(0,("Packet send to %s(%d) failed ERRNO=%s\n",
|
||||
inet_ntoa(ip),port,strerror(errno)));
|
||||
inet_ntoa(ip),port,unix_error_string (errno)));
|
||||
|
||||
close(out_fd);
|
||||
return(ret);
|
||||
@ -707,7 +709,7 @@ int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebin
|
||||
if (port) {
|
||||
if (port == SMB_PORT || port == NMB_PORT)
|
||||
DEBUG(dlevel,("bind failed on port %d socket_addr=%s (%s)\n",
|
||||
port,inet_ntoa(sock.sin_addr),strerror(errno)));
|
||||
port,inet_ntoa(sock.sin_addr),unix_error_string (errno)));
|
||||
close(res);
|
||||
|
||||
if (dlevel > 0 && port < 1000)
|
||||
@ -780,7 +782,7 @@ connect_again:
|
||||
|
||||
if (ret < 0) {
|
||||
DEBUG(1,("error connecting to %s:%d (%s)\n",
|
||||
inet_ntoa(*addr),port,strerror(errno)));
|
||||
inet_ntoa(*addr),port,unix_error_string (errno)));
|
||||
close(res);
|
||||
return -1;
|
||||
}
|
||||
@ -826,7 +828,7 @@ char *client_name(int fd)
|
||||
}
|
||||
|
||||
if (getpeername(fd, &sa, &length) < 0) {
|
||||
DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
|
||||
DEBUG(0,("getpeername failed. Error was %s\n", unix_error_string (errno) ));
|
||||
return name_buf;
|
||||
}
|
||||
|
||||
@ -871,7 +873,7 @@ char *client_addr(int fd)
|
||||
}
|
||||
|
||||
if (getpeername(fd, &sa, &length) < 0) {
|
||||
DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) ));
|
||||
DEBUG(0,("getpeername failed. Error was %s\n", unix_error_string (errno) ));
|
||||
return addr_buf;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
const char *unix_error_string (int error_num);
|
||||
extern pstring scope;
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
@ -228,7 +229,7 @@ FILE *startlmhosts(const char *fname)
|
||||
FILE *fp = sys_fopen(fname,"r");
|
||||
if (!fp) {
|
||||
DEBUG(4,("startlmhosts: Cannot open lmhosts file %s. Error was %s\n",
|
||||
fname, strerror(errno)));
|
||||
fname, unix_error_string (errno)));
|
||||
return NULL;
|
||||
}
|
||||
return fp;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
const char *unix_error_string (int error_num);
|
||||
extern int DEBUGLEVEL;
|
||||
|
||||
int num_good_sends = 0;
|
||||
@ -722,7 +723,7 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
|
||||
|
||||
if (!ret)
|
||||
DEBUG(0,("Packet send failed to %s(%d) ERRNO=%s\n",
|
||||
inet_ntoa(ip),port,strerror(errno)));
|
||||
inet_ntoa(ip),port, unix_error_string (errno)));
|
||||
|
||||
if (ret)
|
||||
num_good_sends++;
|
||||
|
@ -80,6 +80,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
const char *unix_error_string (int error_num);
|
||||
|
||||
/* -------------------------------------------------------------------------- **
|
||||
* Constants...
|
||||
@ -504,7 +505,7 @@ static FILE *OpenConfFile( const char *FileName )
|
||||
{
|
||||
DEBUG( lvl,
|
||||
("%s Unable to open configuration file \"%s\":\n\t%s\n",
|
||||
func, FileName, strerror(errno)) );
|
||||
func, FileName, unix_error_string (errno)) );
|
||||
}
|
||||
|
||||
return( OpenedFile );
|
||||
|
@ -434,7 +434,7 @@ smbfs_errno (struct vfs_class *me)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
DEBUG(3, ("smbfs_errno: %s\n", g_strerror(my_errno)));
|
||||
DEBUG(3, ("smbfs_errno: %s\n", unix_error_string (my_errno)));
|
||||
return my_errno;
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ smbfs_chkpath(struct cli_state *cli, const char *path, BOOL send_only)
|
||||
if ((my_errno = cli_error(cli, NULL, NULL, NULL))) {
|
||||
if (my_errno == 20 || my_errno == 13)
|
||||
return True; /* ignore if 'not a directory' error */
|
||||
DEBUG(3, ("smbfs_chkpath: cli_error: %s\n", g_strerror(my_errno)));
|
||||
DEBUG(3, ("smbfs_chkpath: cli_error: %s\n", unix_error_string (my_errno)));
|
||||
return False;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user