summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-03-23 17:04:47 +0000
committerEric Andersen2001-03-23 17:04:47 +0000
commit8ffaf8d139a51b33497a3e80804d7bf1f60875e6 (patch)
tree8baf8f1bb0c74fa6efeae2862dff18312b657819
parentc54f9530eee722a6959087b3b0938b4bb0a3603b (diff)
downloadbusybox-8ffaf8d139a51b33497a3e80804d7bf1f60875e6.zip
busybox-8ffaf8d139a51b33497a3e80804d7bf1f60875e6.tar.gz
-Wshadow logread fix from Jeff Garzik
-rw-r--r--logread.c18
-rw-r--r--sysklogd/logread.c18
2 files changed, 18 insertions, 18 deletions
diff --git a/logread.c b/logread.c
index ea881e6..19e8aef 100644
--- a/logread.c
+++ b/logread.c
@@ -58,8 +58,8 @@ static struct shbuf_ds {
static struct sembuf SMrup[1] = {{0, -1, IPC_NOWAIT | SEM_UNDO}}; // set SMrup
static struct sembuf SMrdn[2] = {{1, 0}, {0, +1, SEM_UNDO}}; // set SMrdn
-static int shmid = -1; // ipc shared memory id
-static int semid = -1; // ipc semaphore id
+static int log_shmid = -1; // ipc shared memory id
+static int log_semid = -1; // ipc semaphore id
static jmp_buf jmp_env;
static void error_exit(const char *str);
@@ -97,17 +97,17 @@ extern int logread_main(int argc, char **argv)
// attempt to redefine ^C signal
signal(SIGINT, interrupted);
- if ( (shmid = shmget(KEY_ID, 0, 0)) == -1)
+ if ( (log_shmid = shmget(KEY_ID, 0, 0)) == -1)
error_exit("Can't find circular buffer");
// Attach shared memory to our char*
- if ( (buf = shmat(shmid, NULL, SHM_RDONLY)) == NULL)
+ if ( (buf = shmat(log_shmid, NULL, SHM_RDONLY)) == NULL)
error_exit("Can't get access to circular buffer from syslogd");
- if ( (semid = semget(KEY_ID, 0, 0)) == -1)
+ if ( (log_semid = semget(KEY_ID, 0, 0)) == -1)
error_exit("Can't get access to semaphone(s) for circular buffer from syslogd");
- sem_down(semid);
+ sem_down(log_semid);
// Read Memory
i=buf->head;
@@ -122,10 +122,10 @@ extern int logread_main(int argc, char **argv)
if (i >= buf->size )
i=0;
}
- sem_up(semid);
+ sem_up(log_semid);
output_end:
- if (shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
return EXIT_SUCCESS;
@@ -139,7 +139,7 @@ static void interrupted(int sig){
static void error_exit(const char *str){
perror(str);
//release all acquired resources
- if (shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
exit(1);
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index ea881e6..19e8aef 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -58,8 +58,8 @@ static struct shbuf_ds {
static struct sembuf SMrup[1] = {{0, -1, IPC_NOWAIT | SEM_UNDO}}; // set SMrup
static struct sembuf SMrdn[2] = {{1, 0}, {0, +1, SEM_UNDO}}; // set SMrdn
-static int shmid = -1; // ipc shared memory id
-static int semid = -1; // ipc semaphore id
+static int log_shmid = -1; // ipc shared memory id
+static int log_semid = -1; // ipc semaphore id
static jmp_buf jmp_env;
static void error_exit(const char *str);
@@ -97,17 +97,17 @@ extern int logread_main(int argc, char **argv)
// attempt to redefine ^C signal
signal(SIGINT, interrupted);
- if ( (shmid = shmget(KEY_ID, 0, 0)) == -1)
+ if ( (log_shmid = shmget(KEY_ID, 0, 0)) == -1)
error_exit("Can't find circular buffer");
// Attach shared memory to our char*
- if ( (buf = shmat(shmid, NULL, SHM_RDONLY)) == NULL)
+ if ( (buf = shmat(log_shmid, NULL, SHM_RDONLY)) == NULL)
error_exit("Can't get access to circular buffer from syslogd");
- if ( (semid = semget(KEY_ID, 0, 0)) == -1)
+ if ( (log_semid = semget(KEY_ID, 0, 0)) == -1)
error_exit("Can't get access to semaphone(s) for circular buffer from syslogd");
- sem_down(semid);
+ sem_down(log_semid);
// Read Memory
i=buf->head;
@@ -122,10 +122,10 @@ extern int logread_main(int argc, char **argv)
if (i >= buf->size )
i=0;
}
- sem_up(semid);
+ sem_up(log_semid);
output_end:
- if (shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
return EXIT_SUCCESS;
@@ -139,7 +139,7 @@ static void interrupted(int sig){
static void error_exit(const char *str){
perror(str);
//release all acquired resources
- if (shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
exit(1);