summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-15 02:52:51 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-15 02:52:51 +0000
commita4e537322ffa6442a7491956ecf71484c848ae04 (patch)
treec1d70f122936c69a8baf629ae43bc459b11953fd /source3
parentce5e230952c18b2308d0e41fff39f0bfdf2cc32b (diff)
downloadsamba-a4e537322ffa6442a7491956ecf71484c848ae04.tar.gz
samba-a4e537322ffa6442a7491956ecf71484c848ae04.tar.bz2
samba-a4e537322ffa6442a7491956ecf71484c848ae04.zip
use open() not fopen() on codepage files.
in general we need to get rid of all uses of fopen(). The hard one will be the debug code and dbf. (This used to be commit 3992a5169c0b3805c38729c3856c41b1b2527765)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/charset.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/lib/charset.c b/source3/lib/charset.c
index 6e5a4b48cb..3d081246fd 100644
--- a/source3/lib/charset.c
+++ b/source3/lib/charset.c
@@ -188,7 +188,7 @@ static codepage_p load_client_codepage( int client_codepage )
{
pstring codepage_file_name;
unsigned char buf[8];
- FILE *fp = NULL;
+ int fd = -1;
SMB_OFF_T size;
codepage_p cp_p = NULL;
SMB_STRUCT_STAT st;
@@ -235,14 +235,14 @@ code page file (size=%d).\n", codepage_file_name, (int)size));
is held in little endian format.
*/
- if((fp = sys_fopen( codepage_file_name, "r")) == NULL)
+ if((fd = open(codepage_file_name, O_RDONLY)) == -1)
{
DEBUG(0,("load_client_codepage: cannot open file %s. Error was %s\n",
codepage_file_name, strerror(errno)));
return NULL;
}
- if(fread( buf, 1, CODEPAGE_HEADER_SIZE, fp)!=CODEPAGE_HEADER_SIZE)
+ if (read(fd, buf, CODEPAGE_HEADER_SIZE)!=CODEPAGE_HEADER_SIZE)
{
DEBUG(0,("load_client_codepage: cannot read header from file %s. Error was %s\n",
codepage_file_name, strerror(errno)));
@@ -295,7 +295,7 @@ multiple of 4.\n", codepage_file_name));
goto clean_and_exit;
}
- if(fread( (char *)cp_p, 1, size, fp)!=size)
+ if(read(fd, (char *)cp_p, size)!=size)
{
DEBUG(0,("load_client_codepage: read fail on file %s. Error was %s.\n",
codepage_file_name, strerror(errno)));
@@ -305,15 +305,15 @@ multiple of 4.\n", codepage_file_name));
/* Ensure array is correctly terminated. */
memset(((char *)cp_p) + size, '\0', 4);
- fclose(fp);
+ close(fd);
return cp_p;
clean_and_exit:
/* pseudo destructor :-) */
- if(fp != NULL)
- fclose(fp);
+ if(fd != -1)
+ close(fd);
if(cp_p)
free((char *)cp_p);
return NULL;