Commit 3ed6c35b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Minor polish while here anyway

parent 873e75b2
......@@ -161,7 +161,7 @@ void mgt_SHM_Init(void);
void mgt_SHM_static_alloc(const void *, ssize_t size,
const char *class, const char *type, const char *ident);
void mgt_SHM_Create(void);
void mgt_SHM_Commit(void);
int mgt_SHM_Commit(void);
void mgt_SHM_Destroy(int keep);
void mgt_SHM_Size_Adjust(void);
......
......@@ -764,7 +764,9 @@ MGT_Run(void)
}
}
mgt_SHM_Commit();
i = mgt_SHM_Commit();
if (i != 0)
MGT_complain(C_ERR, "Could not commit SHM file");
i = vev_schedule(mgt_evb);
if (i != 0)
......
......@@ -251,20 +251,22 @@ mgt_SHM_Create(void)
* Commit the VSM
*/
void
int
mgt_SHM_Commit(void)
{
char fnbuf[64];
int retval = 0;
bprintf(fnbuf, "%s.%jd", VSM_FILENAME, (intmax_t)getpid());
VJ_master(JAIL_MASTER_FILE);
if (rename(fnbuf, VSM_FILENAME)) {
fprintf(stderr, "Rename failed %s -> %s: %s\n",
MGT_complain(C_ERR, "Rename failed %s -> %s: %s\n",
fnbuf, VSM_FILENAME, strerror(errno));
(void)unlink(fnbuf);
exit(1);
retval = -1;
}
VJ_master(JAIL_MASTER_LOW);
return (retval);
}
/*--------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment