summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/ppp
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/ppp')
-rw-r--r--mdk-stage1/ppp/pppd/tdb.c24
-rw-r--r--mdk-stage1/ppp/pppd/utils.c4
2 files changed, 12 insertions, 16 deletions
diff --git a/mdk-stage1/ppp/pppd/tdb.c b/mdk-stage1/ppp/pppd/tdb.c
index 7fd58291e..045460656 100644
--- a/mdk-stage1/ppp/pppd/tdb.c
+++ b/mdk-stage1/ppp/pppd/tdb.c
@@ -272,7 +272,7 @@ static char *tdb_alloc_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_len len)
free(buf);
return NULL;
}
-
+
return buf;
}
@@ -431,7 +431,7 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length)
rec.rec_len = length;
rec.next = rec_ptr + sizeof(rec) + rec.rec_len;
-
+
if (rec_write(tdb, rec.next, &newrec) == -1) {
goto fail;
}
@@ -447,7 +447,7 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length)
if (ofs_write(tdb, offset, &rec.next) == -1) {
goto fail;
- }
+ }
} else {
lastrec.next = rec.next;
if (rec_write(tdb, last_ptr, &lastrec) == -1) {
@@ -482,7 +482,6 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length)
static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size)
{
struct tdb_header header;
- tdb_off offset;
int i, size = 0;
tdb_off buf[16];
@@ -493,15 +492,14 @@ static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size)
header.hash_size = hash_size;
lseek(tdb->fd, 0, SEEK_SET);
ftruncate(tdb->fd, 0);
-
+
if (tdb->fd != -1 && write(tdb->fd, &header, sizeof(header)) !=
sizeof(header)) {
tdb->ecode = TDB_ERR_IO;
return -1;
} else size += sizeof(header);
-
+
/* the freelist and hash pointers */
- offset = 0;
memset(buf, 0, sizeof(buf));
for (i=0;(hash_size+1)-i >= 16; i += 16) {
@@ -543,7 +541,7 @@ static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, unsigned int hash,
struct list_struct *rec)
{
tdb_off offset, rec_ptr;
-
+
/* find the top of the hash chain */
offset = tdb_hash_top(tdb, hash);
@@ -680,7 +678,7 @@ TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key)
rec.data_len);
ret.dsize = rec.data_len;
}
-
+
tdb_unlock(tdb, BUCKET(hash));
return ret;
}
@@ -696,7 +694,7 @@ int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key)
unsigned hash;
tdb_off rec_ptr;
struct list_struct rec;
-
+
if (tdb == NULL) {
#ifdef TDB_DEBUG
printf("tdb_exists() called with null context\n");
@@ -859,7 +857,7 @@ TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key)
/* find which hash bucket it is in */
hash = tdb_hash(&key);
hbucket = BUCKET(hash);
-
+
tdb_lock(tdb, hbucket);
rec_ptr = tdb_find(tdb, key, hash, &rec);
if (rec_ptr) {
@@ -951,7 +949,7 @@ int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key)
lastrec.next = rec.next;
if (rec_write(tdb, last_ptr, &lastrec) == -1) {
goto fail;
- }
+ }
}
tdb_unlock(tdb, BUCKET(hash));
tdb_lock(tdb, -1);
@@ -1132,7 +1130,7 @@ TDB_CONTEXT *tdb_open(char *name, int hash_size, int tdb_flags,
/* ensure there is only one process initialising at once */
tdb_brlock(&tdb, GLOBAL_LOCK, LOCK_SET, F_WRLCK, F_SETLKW);
-
+
if (tdb_flags & TDB_CLEAR_IF_FIRST) {
/* we need to zero the database if we are the only
one with it open */
diff --git a/mdk-stage1/ppp/pppd/utils.c b/mdk-stage1/ppp/pppd/utils.c
index 64b960a63..0294ccf42 100644
--- a/mdk-stage1/ppp/pppd/utils.c
+++ b/mdk-stage1/ppp/pppd/utils.c
@@ -616,10 +616,9 @@ logit(level, fmt, args)
char *fmt;
va_list args;
{
- int n;
char buf[1024];
- n = vslprintf(buf, sizeof(buf), fmt, args);
+ vslprintf(buf, sizeof(buf), fmt, args);
log_write(level, buf);
}
@@ -946,4 +945,3 @@ unlock()
lock_file[0] = 0;
}
}
-