blob: 9baee6d80f76da88fb726e6c4e6cd31dc6bc3891 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
--- lashd/store.c.orig 2007-01-13 22:08:54 UTC
+++ lashd/store.c
@@ -36,6 +36,31 @@
#define STORE_INFO_FILE ".store_info"
+ssize_t
+getline (char **lineptr, size_t *n, FILE *stream)
+{
+ int linelen;
+
+ char *line=fgetln(stream, &linelen);
+
+ if (line==NULL) {
+ *lineptr=NULL;
+ return -1;
+ }
+
+ if (linelen + 1 > *n ) {
+ *lineptr=realloc(*lineptr, linelen + 1);
+ *n=linelen + 1;
+
+ if (lineptr==NULL)
+ return -1;
+ }
+
+ strlcpy(*lineptr, line, linelen + 1);
+
+ return linelen;
+}
+
void
store_free(store_t * store)
{
|