Skip to content

Commit 97720f9

Browse files
committed
Finalize the name of the fgets family of functions
1 parent ac0a9a3 commit 97720f9

File tree

11 files changed

+100
-100
lines changed

11 files changed

+100
-100
lines changed

audisp/plugins/af_unix/audisp-af_unix.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ void read_audit_record(int ifd)
247247
int len;
248248

249249
// Read stdin
250-
if ((len = audit_fgets(rx_buf, MAX_AUDIT_EVENT_FRAME_SIZE + 1,
250+
if ((len = auplugin_fgets(rx_buf,MAX_AUDIT_EVENT_FRAME_SIZE + 1,
251251
ifd)) > 0) {
252252
#ifdef DEBUG
253253
write(1, rx_buf, len);
@@ -300,16 +300,16 @@ void read_audit_record(int ifd)
300300
close(conn);
301301
conn = -1;
302302
client = 0;
303-
audit_fgets_clear();
303+
auplugin_fgets_clear();
304304
}
305305
//if (rc >= 0 && rc != len) {
306306
// what to do with leftovers?
307307
//}
308308
}
309309
}
310-
} else if (audit_fgets_eof())
310+
} else if (auplugin_fgets_eof())
311311
stop = 1;
312-
} while (audit_fgets_more(MAX_AUDIT_EVENT_FRAME_SIZE));
312+
} while (auplugin_fgets_more(MAX_AUDIT_EVENT_FRAME_SIZE));
313313
}
314314

315315
void accept_connection(void)
@@ -362,7 +362,7 @@ void event_loop(int ifd)
362362
close(conn);
363363
conn = -1;
364364
client = 0;
365-
audit_fgets_clear();
365+
auplugin_fgets_clear();
366366
}
367367
if (pfd[0].revents & POLLIN) {
368368
// Inbound audit event

audisp/plugins/ids/ids.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,15 @@ int main(void)
275275
if (FD_ISSET(0, &read_mask)) {
276276
do {
277277
int len;
278-
if ((len = audit_fgets(tmp,
278+
if ((len = auplugin_fgets(tmp,
279279
MAX_AUDIT_MESSAGE_LENGTH,
280280
0)) > 0) {
281281
/* char *buf = strndup(tmp, 40);
282282
my_printf("auparse_feed %s", buf);
283283
free(buf); */
284284
auparse_feed(au, tmp, len);
285285
}
286-
} while (audit_fgets_more(
286+
} while (auplugin_fgets_more(
287287
MAX_AUDIT_MESSAGE_LENGTH));
288288
}
289289
if (FD_ISSET(tfd, &read_mask)) {
@@ -292,7 +292,7 @@ int main(void)
292292
}
293293

294294
}
295-
if (audit_fgets_eof())
295+
if (auplugin_fgets_eof())
296296
break;
297297
} while (stop == 0);
298298

audisp/plugins/remote/audisp-remote.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ int main(int argc, char *argv[])
596596
// See if input fd is also set
597597
if (FD_ISSET(ifd, &rfd)) {
598598
do {
599-
if (audit_fgets(event,sizeof(event),ifd) > 0) {
599+
if (auplugin_fgets(event,sizeof(event),ifd) > 0) {
600600
if (!transport_ok && remote_ended &&
601601
(config.remote_ending_action ==
602602
FA_RECONNECT ||
@@ -634,9 +634,9 @@ int main(int argc, char *argv[])
634634
else
635635
queue_error();
636636
}
637-
} else if (audit_fgets_eof())
637+
} else if (auplugin_fgets_eof())
638638
stop = 1;
639-
} while (audit_fgets_more(sizeof(event)));
639+
} while (auplugin_fgets_more(sizeof(event)));
640640
}
641641
// See if output fd is also set
642642
if (sock >= 0 && FD_ISSET(sock, &wfd)) {

audisp/plugins/syslog/audisp-syslog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ int main(int argc, const char *argv[])
250250
if (!stop && !hup && retval > 0) {
251251
if (FD_ISSET(0, &read_mask)) {
252252
do {
253-
if (audit_fgets(tmp,
253+
if (auplugin_fgets(tmp,
254254
MAX_AUDIT_MESSAGE_LENGTH, 0) > 0)
255255
write_syslog(tmp);
256-
} while (audit_fgets_more(
256+
} while (auplugin_fgets_more(
257257
MAX_AUDIT_MESSAGE_LENGTH));
258258
}
259259
}
260-
if (audit_fgets_eof())
260+
if (auplugin_fgets_eof())
261261
break;
262262
} while (stop == 0);
263263

auplugin/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/lib -I${top_srcdir}/auplugin
2929
lib_LTLIBRARIES = libauplugin.la
3030
include_HEADERS = auplugin.h
3131

32-
libauplugin_la_SOURCES = audit-fgets.c
32+
libauplugin_la_SOURCES = auplugin-fgets.c
3333
libauplugin_la_LDFLAGS = -Wl,-z,relro -version-info $(VERSION_INFO)
3434

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,45 +43,45 @@
4343

4444
#define BUF_SIZE 8192
4545

46-
struct audit_fgets_state {
46+
struct auplugin_fgets_state {
4747
char buffer[2*BUF_SIZE+1];
4848
char *current;
4949
char *eptr;
5050
int eof;
5151
};
5252

53-
static struct audit_fgets_state global_state;
53+
static struct auplugin_fgets_state global_state;
5454
static int global_init_done;
5555

56-
static void audit_fgets_state_init(struct audit_fgets_state *st)
56+
static void auplugin_fgets_state_init(struct auplugin_fgets_state *st)
5757
{
5858
st->buffer[0] = '\0';
5959
st->current = st->buffer;
6060
st->eptr = st->buffer + (2*BUF_SIZE);
6161
st->eof = 0;
6262
}
6363

64-
struct audit_fgets_state *audit_fgets_init(void)
64+
struct auplugin_fgets_state *auplugin_fgets_init(void)
6565
{
66-
struct audit_fgets_state *st = malloc(sizeof(*st));
66+
struct auplugin_fgets_state *st = malloc(sizeof(*st));
6767
if (st)
68-
audit_fgets_state_init(st);
68+
auplugin_fgets_state_init(st);
6969
return st;
7070
}
7171

72-
void audit_fgets_destroy(struct audit_fgets_state *st)
72+
void auplugin_fgets_destroy(struct auplugin_fgets_state *st)
7373
{
7474
free(st);
7575
}
7676

77-
int audit_fgets_eof_r(struct audit_fgets_state *st)
77+
int auplugin_fgets_eof_r(struct auplugin_fgets_state *st)
7878
{
7979
return st->eof;
8080
}
8181

8282
/* This function dumps any accumulated text. This is to remove dangling text
8383
* that never got consumed for the intended purpose. */
84-
void audit_fgets_clear_r(struct audit_fgets_state *st)
84+
void auplugin_fgets_clear_r(struct auplugin_fgets_state *st)
8585
{
8686
st->buffer[0] = 0;
8787
st->current = st->buffer;
@@ -92,7 +92,7 @@ void audit_fgets_clear_r(struct audit_fgets_state *st)
9292
* and ready to process. If we have a newline or enough
9393
* bytes we return 1 for success. Otherwise 0 meaning that
9494
* there is not enough to process without blocking. */
95-
int audit_fgets_more_r(struct audit_fgets_state *st, size_t blen)
95+
int auplugin_fgets_more_r(struct auplugin_fgets_state *st, size_t blen)
9696
{
9797
size_t avail;
9898
char *nl;
@@ -110,7 +110,7 @@ int audit_fgets_more_r(struct audit_fgets_state *st, size_t blen)
110110
* copy into buf, NUL-terminate, and return the number of chars.
111111
* It also returns 0 for no data. And -1 if there was an error reading
112112
* the fd. */
113-
int audit_fgets_r(struct audit_fgets_state *st, char *buf, size_t blen, int fd)
113+
int auplugin_fgets_r(struct auplugin_fgets_state *st, char *buf, size_t blen, int fd)
114114
{
115115
size_t avail = st->current - st->buffer, line_len;
116116
char *line_end;
@@ -178,35 +178,35 @@ int audit_fgets_r(struct audit_fgets_state *st, char *buf, size_t blen, int fd)
178178
return (int)line_len;
179179
}
180180

181-
static inline void audit_fgets_ensure_global(void)
181+
static inline void auplugin_fgets_ensure_global(void)
182182
{
183183
if (!global_init_done) {
184-
audit_fgets_state_init(&global_state);
184+
auplugin_fgets_state_init(&global_state);
185185
global_init_done = 1;
186186
}
187187
}
188188

189-
int audit_fgets_eof(void)
189+
int auplugin_fgets_eof(void)
190190
{
191-
audit_fgets_ensure_global();
192-
return audit_fgets_eof_r(&global_state);
191+
auplugin_fgets_ensure_global();
192+
return auplugin_fgets_eof_r(&global_state);
193193
}
194194

195-
void audit_fgets_clear(void)
195+
void auplugin_fgets_clear(void)
196196
{
197-
audit_fgets_ensure_global();
198-
audit_fgets_clear_r(&global_state);
197+
auplugin_fgets_ensure_global();
198+
auplugin_fgets_clear_r(&global_state);
199199
}
200200

201-
int audit_fgets_more(size_t blen)
201+
int auplugin_fgets_more(size_t blen)
202202
{
203-
audit_fgets_ensure_global();
204-
return audit_fgets_more_r(&global_state, blen);
203+
auplugin_fgets_ensure_global();
204+
return auplugin_fgets_more_r(&global_state, blen);
205205
}
206206

207-
int audit_fgets(char *buf, size_t blen, int fd)
207+
int auplugin_fgets(char *buf, size_t blen, int fd)
208208
{
209-
audit_fgets_ensure_global();
210-
return audit_fgets_r(&global_state, buf, blen, fd);
209+
auplugin_fgets_ensure_global();
210+
return auplugin_fgets_r(&global_state, buf, blen, fd);
211211
}
212212

auplugin/auplugin.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@
4040
extern "C" {
4141
#endif
4242

43-
typedef struct audit_fgets_state audit_fgets_state_t;
43+
typedef struct auplugin_fgets_state auplugin_fgets_state_t;
4444

45-
void audit_fgets_clear(void);
46-
int audit_fgets_eof(void);
47-
int audit_fgets_more(size_t blen);
48-
int audit_fgets(char *buf, size_t blen, int fd)
45+
void auplugin_fgets_clear(void);
46+
int auplugin_fgets_eof(void);
47+
int auplugin_fgets_more(size_t blen);
48+
int auplugin_fgets(char *buf, size_t blen, int fd)
4949
__attr_access ((__write_only__, 1, 2));
5050

51-
void audit_fgets_destroy(audit_fgets_state_t *st);
52-
audit_fgets_state_t *audit_fgets_init(void)
53-
__attribute_malloc__ __attr_dealloc (audit_fgets_destroy, 1);
54-
void audit_fgets_clear_r(audit_fgets_state_t *st);
55-
int audit_fgets_eof_r(audit_fgets_state_t *st);
56-
int audit_fgets_more_r(audit_fgets_state_t *st, size_t blen);
57-
int audit_fgets_r(audit_fgets_state_t *st, char *buf, size_t blen, int fd)
51+
void auplugin_fgets_destroy(auplugin_fgets_state_t *st);
52+
auplugin_fgets_state_t *auplugin_fgets_init(void)
53+
__attribute_malloc__ __attr_dealloc (auplugin_fgets_destroy, 1);
54+
void auplugin_fgets_clear_r(auplugin_fgets_state_t *st);
55+
int auplugin_fgets_eof_r(auplugin_fgets_state_t *st);
56+
int auplugin_fgets_more_r(auplugin_fgets_state_t *st, size_t blen);
57+
int auplugin_fgets_r(auplugin_fgets_state_t *st, char *buf, size_t blen, int fd)
5858
__attr_access ((__write_only__, 2, 3));
5959

6060
#ifdef __cplusplus

0 commit comments

Comments
 (0)