Removed calls to strerror() function from own libsamba implementation.

Please remember: own libsamba will dropped in near time (we will use libsmbclient instead)
Therefore no need to much changes in own deprecated code.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-11-02 14:14:33 +02:00 committed by Enrico Weigelt, metux IT service
parent d5526e13dc
commit cbdf86f4f8
8 changed files with 34 additions and 28 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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++;

View File

@ -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 );

View File

@ -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;
}