mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-31 21:18:26 +03:00
Move DEFS into configure.h.
Remove dmsetup line buffer limitation.
This commit is contained in:
parent
979ca34259
commit
654f5049eb
@ -1,7 +1,8 @@
|
||||
Version 1.02.06 -
|
||||
=============================
|
||||
Move DEFS into configure.h.
|
||||
Fix leaks in error paths found by coverity.
|
||||
Increase dmsetup line buffer to 4k.
|
||||
Remove dmsetup line buffer limitation.
|
||||
|
||||
Version 1.02.05 - 19 Apr 2006
|
||||
=============================
|
||||
|
@ -16,6 +16,9 @@
|
||||
* dmeventd - dm event daemon to monitor active mapped devices
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "list.h"
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include <configure.h>
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "log.h"
|
||||
|
||||
@ -117,7 +119,9 @@ static struct dm_tree *_dtree;
|
||||
*/
|
||||
static int _parse_file(struct dm_task *dmt, const char *file)
|
||||
{
|
||||
char buffer[LINE_SIZE], ttype[LINE_SIZE], *ptr, *comment;
|
||||
char *buffer = NULL;
|
||||
size_t buffer_size = 0;
|
||||
char ttype[LINE_SIZE], *ptr, *comment;
|
||||
FILE *fp;
|
||||
unsigned long long start, size;
|
||||
int r = 0, n, line = 0;
|
||||
@ -132,7 +136,17 @@ static int _parse_file(struct dm_task *dmt, const char *file)
|
||||
} else
|
||||
fp = stdin;
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), fp)) {
|
||||
#ifndef HAVE_GETLINE
|
||||
buffer_size = LINE_SIZE;
|
||||
if (!(buffer = malloc(buffer_size))) {
|
||||
err("Failed to malloc line buffer.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (fgets(buffer, buffer_size, fp)) {
|
||||
#else
|
||||
while (getline(&buffer, &buffer_size, fp) > 0) {
|
||||
#endif
|
||||
line++;
|
||||
|
||||
/* trim trailing space */
|
||||
@ -164,6 +178,7 @@ static int _parse_file(struct dm_task *dmt, const char *file)
|
||||
r = 1;
|
||||
|
||||
out:
|
||||
free(buffer);
|
||||
if (file)
|
||||
fclose(fp);
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user