library: Cater for 32 char device names
The new library has this boundary set in a define. Also fixed the off-by-one problem with the buffer and scanf References: commit 1794875ab679809dabb2e1a7d6fa21f23b100d4d
This commit is contained in:
parent
5e9c522eea
commit
96e6600c84
@ -34,12 +34,12 @@
|
|||||||
#include "procps-private.h"
|
#include "procps-private.h"
|
||||||
|
|
||||||
#define DISKSTAT_LINE_LEN 1024
|
#define DISKSTAT_LINE_LEN 1024
|
||||||
#define DISKSTAT_NAME_LEN 15
|
#define DISKSTAT_NAME_LEN 34
|
||||||
#define DISKSTAT_FILE "/proc/diskstats"
|
#define DISKSTAT_FILE "/proc/diskstats"
|
||||||
#define SYSBLOCK_DIR "/sys/block"
|
#define SYSBLOCK_DIR "/sys/block"
|
||||||
|
|
||||||
struct procps_diskstat_dev {
|
struct procps_diskstat_dev {
|
||||||
char name[DISKSTAT_NAME_LEN];
|
char name[DISKSTAT_NAME_LEN+1];
|
||||||
int is_disk;
|
int is_disk;
|
||||||
unsigned long reads;
|
unsigned long reads;
|
||||||
unsigned long reads_merged;
|
unsigned long reads_merged;
|
||||||
@ -186,7 +186,7 @@ PROCPS_EXPORT int procps_diskstat_read (
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
char buf[DISKSTAT_LINE_LEN];
|
char buf[DISKSTAT_LINE_LEN];
|
||||||
char devname[DISKSTAT_NAME_LEN];
|
char devname[DISKSTAT_NAME_LEN+1];
|
||||||
struct procps_diskstat_dev *disk;
|
struct procps_diskstat_dev *disk;
|
||||||
|
|
||||||
/* clear/zero structures */
|
/* clear/zero structures */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user