summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>2001-01-31 22:41:33 +0000
committerMats O Jansson <maja@cvs.openbsd.org>2001-01-31 22:41:33 +0000
commit2c0395e8c2b8f89db46e02886375cfae6ff1d28a (patch)
tree1eeb5e3ca3966bed723873e8492afd63e9f11514
parenta38d8533b3aa82f6262c91f32abc928a5f07c4aa (diff)
Dont write kernel if nothing has changed. ok @deraadt. -moj
-rw-r--r--usr.sbin/config/cmd.c10
-rw-r--r--usr.sbin/config/ukc.c17
-rw-r--r--usr.sbin/config/ukcutil.c23
3 files changed, 39 insertions, 11 deletions
diff --git a/usr.sbin/config/cmd.c b/usr.sbin/config/cmd.c
index 6dd1c30b979..cba1816ee1a 100644
--- a/usr.sbin/config/cmd.c
+++ b/usr.sbin/config/cmd.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: cmd.c,v 1.3 2000/02/27 21:10:01 deraadt Exp $ */
+/* $OpenBSD: cmd.c,v 1.4 2001/01/31 22:41:32 maja Exp $ */
/*
- * Copyright (c) 1999 Mats O Jansson. All rights reserved.
+ * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: cmd.c,v 1.3 2000/02/27 21:10:01 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmd.c,v 1.4 2001/01/31 22:41:32 maja Exp $";
#endif
#include <sys/types.h>
@@ -47,6 +47,8 @@ static char rcsid[] = "$OpenBSD: cmd.c,v 1.3 2000/02/27 21:10:01 deraadt Exp $";
#include "ukc.h"
#include "exec.h"
+extern int ukc_mod_kernel;
+
/* Our command table */
cmd_table_t cmd_table[] = {
{"help", Xhelp, "\t\t", "Command help list"},
@@ -269,6 +271,8 @@ Xtimezone(cmd)
int num;
char *c;
+ ukc_mod_kernel = 1;
+
tz = (struct timezone *)adjust((caddr_t)(nl[TZ_TZ].n_value));
if (strlen(cmd->args) == 0) {
diff --git a/usr.sbin/config/ukc.c b/usr.sbin/config/ukc.c
index c8e29d55c43..2a455d3d7f2 100644
--- a/usr.sbin/config/ukc.c
+++ b/usr.sbin/config/ukc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: ukc.c,v 1.3 2000/12/06 14:06:16 ho Exp $ */
+/* $OpenBSD: ukc.c,v 1.4 2001/01/31 22:41:32 maja Exp $ */
/*
- * Copyright (c) 1999 Mats O Jansson. All rights reserved.
+ * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ukc.c,v 1.3 2000/12/06 14:06:16 ho Exp $";
+static char rcsid[] = "$OpenBSD: ukc.c,v 1.4 2001/01/31 22:41:32 maja Exp $";
#endif
#include <sys/types.h>
@@ -54,6 +54,8 @@ static char rcsid[] = "$OpenBSD: ukc.c,v 1.3 2000/12/06 14:06:16 ho Exp $";
void init __P((void));
void usage __P((void));
+int ukc_mod_kernel = 0;
+
int
ukc(file, outfile, uflag, force)
char *file;
@@ -157,8 +159,13 @@ WARNING the commands add and change might not work.\n");
}
if (outfile == NULL)
outfile = file;
- printf ("Saving modified kernel.\n");
- savekernel(outfile);
+ if (ukc_mod_kernel == 0) {
+ fprintf(stderr, "Kernel not modified\n");
+ exit(1);
+ } else {
+ printf ("Saving modified kernel.\n");
+ savekernel(outfile);
+ }
}
return(0);
diff --git a/usr.sbin/config/ukcutil.c b/usr.sbin/config/ukcutil.c
index 354df3800f4..c7c52ab4052 100644
--- a/usr.sbin/config/ukcutil.c
+++ b/usr.sbin/config/ukcutil.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: ukcutil.c,v 1.4 2001/01/15 23:53:34 maja Exp $ */
+/* $OpenBSD: ukcutil.c,v 1.5 2001/01/31 22:41:32 maja Exp $ */
/*
- * Copyright (c) 1999 Mats O Jansson. All rights reserved.
+ * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$OpenBSD: ukcutil.c,v 1.4 2001/01/15 23:53:34 maja Exp $";
+static char rcsid[] = "$OpenBSD: ukcutil.c,v 1.5 2001/01/31 22:41:32 maja Exp $";
#endif
#include <sys/types.h>
@@ -47,6 +47,8 @@ static char rcsid[] = "$OpenBSD: ukcutil.c,v 1.4 2001/01/15 23:53:34 maja Exp $"
#include "ukc.h"
#include "misc.h"
+extern int ukc_mod_kernel;
+
struct cfdata *
get_cfdata(idx)
int idx;
@@ -341,6 +343,8 @@ modify(item, val)
cmd_t cmd;
int a;
+ ukc_mod_kernel = 1;
+
while(1) {
printf("%s [", item);
pnum(*val);
@@ -373,6 +377,8 @@ change(devno)
int i,share = 0,*j,*k,*l;
short *ln,*lk;
+ ukc_mod_kernel = 1;
+
j = k = NULL;
if (devno <= maxdev) {
@@ -461,6 +467,8 @@ change_history(devno,str)
int i,share = 0,*j,*k,*l;
short *ln,*lk;
+ ukc_mod_kernel = 1;
+
j = k = NULL;
if (devno <= maxdev) {
@@ -553,6 +561,8 @@ disable(devno)
struct cfdata *cd;
int done = 0;
+ ukc_mod_kernel = 1;
+
if (devno <= maxdev) {
cd = get_cfdata(devno);
@@ -590,6 +600,8 @@ enable(devno)
struct cfdata *cd;
int done = 0;
+ ukc_mod_kernel = 1;
+
if (devno <= maxdev) {
cd = get_cfdata(devno);
@@ -921,6 +933,8 @@ add(dev, len, unit, state)
struct cfdriver *cdrv;
int val, max_unit;
+ ukc_mod_kernel = 1;
+
bzero(&new, sizeof(struct cfdata));
if (maxdev == totdev) {
@@ -1063,6 +1077,8 @@ add_history(devno, unit, state, newno)
int len;
char *dev;
+ ukc_mod_kernel = 1;
+
bzero(&new, sizeof(struct cfdata));
cd = get_cfdata(devno);
@@ -1281,6 +1297,7 @@ process_history(len,buf)
while (*c != ' ') c++; c++;
tz->tz_dsttime = atoi(c);
while (*c != '\n') c++; c++;
+ ukc_mod_kernel = 1;
break;
case 'q':
while (*c != NULL) c++;