mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +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 -
|
Version 1.02.06 -
|
||||||
=============================
|
=============================
|
||||||
|
Move DEFS into configure.h.
|
||||||
Fix leaks in error paths found by coverity.
|
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
|
Version 1.02.05 - 19 Apr 2006
|
||||||
=============================
|
=============================
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
* dmeventd - dm event daemon to monitor active mapped devices
|
* dmeventd - dm event daemon to monitor active mapped devices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
#include "libdevmapper.h"
|
#include "libdevmapper.h"
|
||||||
#include "libdevmapper-event.h"
|
#include "libdevmapper-event.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
|
#include <configure.h>
|
||||||
|
|
||||||
#include "libdevmapper.h"
|
#include "libdevmapper.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
@ -117,7 +119,9 @@ static struct dm_tree *_dtree;
|
|||||||
*/
|
*/
|
||||||
static int _parse_file(struct dm_task *dmt, const char *file)
|
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;
|
FILE *fp;
|
||||||
unsigned long long start, size;
|
unsigned long long start, size;
|
||||||
int r = 0, n, line = 0;
|
int r = 0, n, line = 0;
|
||||||
@ -132,7 +136,17 @@ static int _parse_file(struct dm_task *dmt, const char *file)
|
|||||||
} else
|
} else
|
||||||
fp = stdin;
|
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++;
|
line++;
|
||||||
|
|
||||||
/* trim trailing space */
|
/* trim trailing space */
|
||||||
@ -164,6 +178,7 @@ static int _parse_file(struct dm_task *dmt, const char *file)
|
|||||||
r = 1;
|
r = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
free(buffer);
|
||||||
if (file)
|
if (file)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return r;
|
return r;
|
||||||
|
Loading…
Reference in New Issue
Block a user