summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c2
-rw-r--r--source3/nmbd/nmbd_serverlistdb.c3
-rw-r--r--source3/nmbd/nmbd_winsserver.c21
3 files changed, 13 insertions, 13 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 482e136ba4..d7383fb736 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -68,7 +68,7 @@ static void sig_term(int sig)
DEBUG(0,("Got SIGTERM: going down...\n"));
/* Write out wins.dat file if samba is a WINS server */
- wins_write_database();
+ wins_write_database(False);
/* Remove all SELF registered names. */
release_my_names();
diff --git a/source3/nmbd/nmbd_serverlistdb.c b/source3/nmbd/nmbd_serverlistdb.c
index a4dab6f419..458fbd0085 100644
--- a/source3/nmbd/nmbd_serverlistdb.c
+++ b/source3/nmbd/nmbd_serverlistdb.c
@@ -321,6 +321,8 @@ void write_browse_list(time_t t, BOOL force_write)
return;
}
+ lasttime = t;
+
dump_workgroups(force_write);
for (subrec = FIRST_SUBNET; subrec ; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
@@ -335,7 +337,6 @@ void write_browse_list(time_t t, BOOL force_write)
if(!list_changed)
return;
- lasttime = t;
updatecount++;
pstrcpy(fname,lp_lockdir());
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 1502dd8155..3c831ee1ea 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -1535,7 +1535,7 @@ void initiate_wins_processing(time_t t)
expire_names_on_subnet(wins_server_subnet, t);
if(wins_server_subnet->namelist_changed)
- wins_write_database();
+ wins_write_database(True);
wins_server_subnet->namelist_changed = False;
}
@@ -1543,7 +1543,7 @@ void initiate_wins_processing(time_t t)
/*******************************************************************
Write out the current WINS database.
******************************************************************/
-void wins_write_database(void)
+void wins_write_database(BOOL background)
{
struct name_record *namerec;
pstring fname, fnamenew;
@@ -1556,16 +1556,15 @@ void wins_write_database(void)
/* we will do the writing in a child process to ensure that the parent
doesn't block while this is done */
- if ((child_pid=fork())) {
- return;
+ if (background) {
+ CatchChild();
+ if ((child_pid=fork())) {
+ return;
+ }
}
- pstrcpy(fname,lp_lockdir());
- trim_string(fname,NULL,"/");
- pstrcat(fname,"/");
- pstrcat(fname,WINS_LIST);
- pstrcpy(fnamenew,fname);
- pstrcat(fnamenew,".");
+ slprintf(fname,sizeof(fname),"%s/%s.%d", lp_lockdir(), WINS_LIST, getpid());
+ string_sub(s->fname,"//", "/");
if((fp = fopen(fnamenew,"w")) == NULL)
{
@@ -1612,7 +1611,7 @@ void wins_write_database(void)
}
fclose(fp);
- unlink(fname);
chmod(fnamenew,0644);
+ unlink(fname);
rename(fnamenew,fname);
}