Factor mailbox_create() out of nat_reset() and files.c

This commit is contained in:
Markus Armbruster 2011-11-26 16:01:51 +01:00
parent 8b7591f5d7
commit c4337f7aec
4 changed files with 17 additions and 10 deletions

View file

@ -33,6 +33,9 @@
#include <config.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include "optlist.h"
#include "tel.h"
#include "prototypes.h"
@ -44,6 +47,16 @@ mailbox(char *buf, natid cn)
return buf;
}
/*
* Create an empty telegram file named MBOX.
*/
int
mailbox_create(char *mbox)
{
close(creat(mbox, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP));
return 0;
}
/*
* Read telegram header from FP into TEL.
* MBOX is the file name, it is used for logging errors.