summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-02 09:07:17 +0000
commit6d66fb308ab85bd9691d541764e683e6040cf724 (patch)
tree10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/smbd/dir.c
parentc105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff)
downloadsamba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz
samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.bz2
samba-6d66fb308ab85bd9691d541764e683e6040cf724.zip
BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 396ecd98c4..d3c71ad24e 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -327,15 +327,20 @@ void dptr_closepath(char *path,uint16 spid)
Start a directory listing.
****************************************************************************/
-static BOOL start_dir(connection_struct *conn,char *directory)
+static BOOL start_dir(connection_struct *conn, pstring directory)
{
+ const char *dir2;
+
DEBUG(5,("start_dir dir=%s\n",directory));
if (!check_name(directory,conn))
return(False);
+
+ /* use a const pointer from here on */
+ dir2 = directory;
- if (! *directory)
- directory = ".";
+ if (! *dir2)
+ dir2 = ".";
conn->dirptr = OpenDir(conn, directory, True);
if (conn->dirptr) {
@@ -392,7 +397,7 @@ static void dptr_close_oldest(BOOL old)
me at Andrew's knee.... :-) :-). JRA.
****************************************************************************/
-int dptr_create(connection_struct *conn,char *path, BOOL old_handle, BOOL expect_close,uint16 spid)
+int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL expect_close,uint16 spid)
{
dptr_struct *dptr;
@@ -812,10 +817,10 @@ static BOOL file_is_special(connection_struct *conn, char *name, SMB_STRUCT_STAT
Open a directory.
********************************************************************/
-void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
+void *OpenDir(connection_struct *conn, const char *name, BOOL use_veto)
{
Dir *dirp;
- char *n;
+ const char *n;
DIR *p = conn->vfs_ops.opendir(conn,name);
int used=0;
@@ -1009,7 +1014,7 @@ static ubi_dlNewList( dir_cache );
Output: None.
*****************************************************************************/
-void DirCacheAdd( char *path, char *name, char *dname, int snum )
+void DirCacheAdd( const char *path, char *name, char *dname, int snum )
{
int pathlen;
int namelen;
@@ -1056,7 +1061,7 @@ void DirCacheAdd( char *path, char *name, char *dname, int snum )
for large caches.
*****************************************************************************/
-char *DirCacheCheck( char *path, char *name, int snum )
+char *DirCacheCheck( const char *path, const char *name, int snum )
{
dir_cache_entry *entry;