diff --git a/common-src/amflock-test.c b/common-src/amflock-test.c index 4cf950e0f5..12a5813262 100644 --- a/common-src/amflock-test.c +++ b/common-src/amflock-test.c @@ -103,7 +103,7 @@ static gboolean inc_counter(file_lock *lock) { char old_val = 'a'; - char new_val[2]; + char new_val; if (lock->len) { old_val = lock->data[0]; @@ -111,9 +111,8 @@ inc_counter(file_lock *lock) g_assert(old_val < 'z'); - new_val[0] = old_val + 1; - new_val[1] = '\0'; - if (file_lock_write(lock, new_val, 1) == -1) { + new_val = old_val + 1; + if (file_lock_write(lock, &new_val, 1) == -1) { g_fprintf(stderr, "file_lock_write: %s\n", strerror(errno)); return FALSE; diff --git a/common-src/amflock.c b/common-src/amflock.c index adf4aecf47..e359025510 100644 --- a/common-src/amflock.c +++ b/common-src/amflock.c @@ -314,7 +314,7 @@ file_lock_write( if (lock->data) g_free(lock->data); - lock->data = g_strdup(data); + lock->data = g_strndup(data, len); lock->len = len; return 0; diff --git a/server-src/server_util.c b/server-src/server_util.c index 74baf17735..f7eeefdd43 100644 --- a/server-src/server_util.c +++ b/server-src/server_util.c @@ -29,7 +29,6 @@ * $Id: server_util.c,v 1.17 2006/05/25 01:47:20 johnfranks Exp $ * */ - #include #include "amanda.h"