Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 276715
Collapse All | Expand All

(-)src/librc/librc.h (-2 lines)
Lines 73-78 Link Here
73
#define librc_hidden_def(x) hidden_def(x)
73
#define librc_hidden_def(x) hidden_def(x)
74
74
75
ssize_t rc_getline(char **, size_t *, FILE *);
76
77
librc_hidden_proto(rc_config_list)
75
librc_hidden_proto(rc_config_list)
78
librc_hidden_proto(rc_config_load)
76
librc_hidden_proto(rc_config_load)
(-)src/librc/rc.h.in (+4 lines)
Lines 518-521 Link Here
518
RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t);
518
RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t);
519
519
520
/* getline is a handy glibc function that not all libcs have, so
521
 * we have our own */
522
ssize_t rc_getline(char **, size_t *, FILE *);
523
520
__END_DECLS
524
__END_DECLS
521
#endif
525
#endif
(-)src/librc/rc.map (+1 lines)
Lines 13-16 Link Here
13
	rc_environ_fd;
13
	rc_environ_fd;
14
	rc_find_pids;
14
	rc_find_pids;
15
	rc_getline;
15
	rc_newer_than;
16
	rc_newer_than;
16
	rc_older_than;
17
	rc_older_than;
(-)src/rc/rc.c (-10 / +7 lines)
Lines 43-52 Link Here
43
#include <sys/utsname.h>
43
#include <sys/utsname.h>
44
#include <sys/wait.h>
44
#include <sys/wait.h>
45
45
46
#ifdef __linux__
47
# include <asm/setup.h> /* for COMMAND_LINE_SIZE */
48
#endif
49
50
#include <errno.h>
46
#include <errno.h>
51
#include <dirent.h>
47
#include <dirent.h>
52
#include <ctype.h>
48
#include <ctype.h>
Lines 176-185 Link Here
176
proc_getent(const char *ent)
172
proc_getent(const char *ent)
177
{
173
{
178
	FILE *fp;
174
	FILE *fp;
179
	char proc[COMMAND_LINE_SIZE];
175
	char *proc, *p, *value = NULL;
180
	char *p;
176
	size_t i;
181
	char *value = NULL;
182
	int i;
183
177
184
	if (!exists("/proc/cmdline"))
178
	if (!exists("/proc/cmdline"))
185
		return NULL;
179
		return NULL;
Lines 189-196 Link Here
189
		return NULL;
183
		return NULL;
190
	}
184
	}
191
185
192
	memset(proc, 0, sizeof(proc));
186
	proc = NULL;
193
	fgets(proc, sizeof(proc), fp);
187
	i = 0;
188
	if (rc_getline(&proc, &i, fp) == -1 || proc == NULL)
189
		eerror("rc_getline: %s", strerror(errno));
194
	if (*proc && (p = strstr(proc, ent))) {
190
	if (*proc && (p = strstr(proc, ent))) {
195
		i = p - proc;
191
		i = p - proc;
196
		if (i == '\0' || proc[i - 1] == ' ') {
192
		if (i == '\0' || proc[i - 1] == ' ') {
Lines 202-207 Link Here
202
	} else
198
	} else
203
		errno = ENOENT;
199
		errno = ENOENT;
204
	fclose(fp);
200
	fclose(fp);
201
	free(proc);
205
202
206
	return value;
203
	return value;
207
}
204
}
(-)src/test/rc.funcs.list (+2 lines)
Lines 21-24 Link Here
21
rc_find_pids
21
rc_find_pids
22
rc_find_pids@@RC_1.0
22
rc_find_pids@@RC_1.0
23
rc_getline
24
rc_getline@@RC_1.0
23
rc_newer_than
25
rc_newer_than
24
rc_newer_than@@RC_1.0
26
rc_newer_than@@RC_1.0

Return to bug 276715