r7200: Don't use memset, use SET_STAT_INVALID (has the same effect).
authorJeremy Allison <jra@samba.org>
Thu, 2 Jun 2005 23:18:52 +0000 (23:18 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:05 +0000 (10:57 -0500)
Jeremy.

source/include/smb_macros.h
source/printing/nt_printing.c
source/smbd/dir.c
source/smbd/filename.c
source/smbd/notify_hash.c
source/smbd/service.c

index d798d4395e18aa6f961010f72610607a89a15144..b7e27d22667d1a76225f147509305ce43e5f89c5 100644 (file)
 
 #define VALID_STAT(st) ((st).st_nlink != 0)  
 #define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR((st).st_mode))
+#define SET_STAT_INVALID(st) ((st).st_nlink = 0)
 
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
index caacfef48fc328a02049da57d7824fa335b52140..8564b7c173b9f08f03fdd237c0c517e1ec0256dc 100644 (file)
@@ -1152,8 +1152,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
        SMB_STRUCT_STAT stat_buf;
        BOOL bad_path;
 
-       ZERO_STRUCT(st);
-       ZERO_STRUCT(stat_buf);
+       SET_STAT_INVALID(st);
+       SET_STAT_INVALID(stat_buf);
        new_create_time = (time_t)0;
        old_create_time = (time_t)0;
 
@@ -1265,7 +1265,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
        SMB_STRUCT_STAT   st;
        connection_struct *conn;
 
-       ZERO_STRUCT(st);
+       SET_STAT_INVALID(st);
 
        *perr = WERR_INVALID_PARAM;
 
index d66d1601fbf0aee7a19d8474543c516f146f78f1..935ca20195819a00e3d6344c969cc2a84e196d08 100644 (file)
@@ -560,7 +560,7 @@ const char *dptr_ReadDirName(struct dptr_struct *dptr, long *poffset, SMB_STRUCT
 {
        pstring pathreal;
 
-       ZERO_STRUCTP(pst);
+       SET_STAT_INVALID(pst);
 
        if (dptr->has_wild) {
                return dptr_normal_ReadDirName(dptr, poffset, pst);
@@ -629,7 +629,7 @@ const char *dptr_ReadDirName(struct dptr_struct *dptr, long *poffset, SMB_STRUCT
 
 BOOL dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst)
 {
-       ZERO_STRUCTP(pst);
+       SET_STAT_INVALID(pst);
 
        if (!dptr->has_wild && (dptr->dir_hnd->offset == -1)) {
                /* This is a singleton directory and we're already at the end. */
@@ -958,7 +958,7 @@ BOOL is_visible_file(connection_struct *conn, const char *dir_path, const char *
        BOOL hide_unwriteable = lp_hideunwriteable_files(SNUM(conn));
        BOOL hide_special = lp_hide_special_files(SNUM(conn));
 
-       ZERO_STRUCTP(pst);
+       SET_STAT_INVALID(pst);
 
        if ((strcmp(".",name) == 0) || (strcmp("..",name) == 0)) {
                return True; /* . and .. are always visible. */
index 7191e7571572923ca9ad7cbb89b3b4a01178963c..733001bc91def095e22485bbd05b8718839c3c8f 100644 (file)
@@ -92,7 +92,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
        BOOL component_was_mangled = False;
        BOOL name_has_wildcard = False;
 
-       ZERO_STRUCTP(pst);
+       SET_STAT_INVALID(pst);
 
        *dirpath = 0;
        *bad_path = False;
@@ -258,7 +258,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
                        pstring rest;
 
                        /* Stat failed - ensure we don't use it. */
-                       ZERO_STRUCT(st);
+                       SET_STAT_INVALID(st);
                        *rest = 0;
 
                        /*
@@ -346,7 +346,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
                                if (SMB_VFS_STAT(conn,name, &st) == 0) {
                                        *pst = st;
                                } else {
-                                       ZERO_STRUCT(st);
+                                       SET_STAT_INVALID(st);
                                }
                        }
                } /* end else */
index b16b7677833382575fa6c3e6715a443ff1f62f51..0464eaa2eb3ea364acae3cb4ec76e390f9d14a44 100644 (file)
@@ -91,7 +91,7 @@ static BOOL notify_hash(connection_struct *conn, char *path, uint32 flags,
        
        offset = 0;
        while ((fname = ReadDirName(dp, &offset))) {
-               ZERO_STRUCT(st);
+               SET_STAT_INVALID(st);
                if(strequal(fname, ".") || strequal(fname, ".."))
                        continue;               
 
index c63a43bac0e212eb642647b4e1f550fdadc26695..0566dd8102be97542e6c65c42c3cb7c2476313a6 100644 (file)
@@ -275,7 +275,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
 
        *user = 0;
        fstrcpy(dev, pdev);
-       ZERO_STRUCT(st);
+       SET_STAT_INVALD(st);
 
        if (NT_STATUS_IS_ERR(*status = share_sanity_checks(snum, dev))) {
                return NULL;