Constify savedir pointer, and remove an accompaning strdup() call.

This commit is contained in:
Xin LI 2005-05-29 16:28:07 +00:00
parent 19fb720da7
commit 466e103c7d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146763

View File

@ -181,7 +181,7 @@ getbounds(void) {
* save directory. * save directory.
*/ */
static int static int
check_space(char *savedir, off_t dumpsize) check_space(const char *savedir, off_t dumpsize)
{ {
FILE *fp; FILE *fp;
off_t minfree, spacefree, totfree, needed; off_t minfree, spacefree, totfree, needed;
@ -224,7 +224,7 @@ check_space(char *savedir, off_t dumpsize)
#define BLOCKMASK (~(BLOCKSIZE-1)) #define BLOCKMASK (~(BLOCKSIZE-1))
static void static void
DoFile(char *savedir, const char *device) DoFile(const char *savedir, const char *device)
{ {
static char *buf = NULL; static char *buf = NULL;
struct kerneldumpheader kdhf, kdhl; struct kerneldumpheader kdhf, kdhl;
@ -528,7 +528,7 @@ usage(void)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
char *savedir; const char *savedir = ".";
struct fstab *fsp; struct fstab *fsp;
int i, ch, error; int i, ch, error;
@ -537,11 +537,6 @@ main(int argc, char **argv)
openlog("savecore", LOG_PERROR, LOG_DAEMON); openlog("savecore", LOG_PERROR, LOG_DAEMON);
savedir = strdup(".");
if (savedir == NULL) {
syslog(LOG_ERR, "Cannot allocate memory");
exit(1);
}
while ((ch = getopt(argc, argv, "Ccfkvz")) != -1) while ((ch = getopt(argc, argv, "Ccfkvz")) != -1)
switch(ch) { switch(ch) {
case 'C': case 'C':