Changes:
xxxx/xx/xx: Version 10.0.0 - Sebastien Godard (sysstat <at> orange.fr)
+ * [Ivana Varekova]: Fix a problem with long NFS and CIFS share
+ names in cifsiostat and nfsiostat.
* [Ivana Varekova]: Check calloc() return value in cifsiostat
and nfsiostat.
* [Jan Kaluza]: Added --debuginfo option to cifsiostat and
if ((fp = fopen(CIFSSTATS, "r")) == NULL)
return;
- sprintf(aux, "%%%ds %%10s %%10s",
- MAX_NAME_LEN < 200 ? MAX_NAME_LEN : 200);
+ sprintf(aux, "%%*d) %%%ds",
+ MAX_NAME_LEN < 200 ? MAX_NAME_LEN - 1 : 200);
while (fgets(line, 256, fp) != NULL) {
/* Read CIFS directory name */
- if (isdigit((unsigned char) line[0]) && sscanf(line, "%*d) %s", name_tmp) == 1) {
+ if (isdigit((unsigned char) line[0]) && sscanf(line, aux , name_tmp) == 1) {
if (start) {
save_stats(cifs_name, curr, &scifs);
}
int sw = 0;
char line[256];
char *xprt_line;
+ char *mount_part;
char nfs_name[MAX_NAME_LEN];
char mount[10], on[10], prefix[10], aux[32];
char operation[16];
if ((fp = fopen(NFSMOUNTSTATS, "r")) == NULL)
return;
- sprintf(aux, "%%%ds %%10s %%10s",
+ sprintf(aux, "%%%ds",
MAX_NAME_LEN < 200 ? MAX_NAME_LEN : 200);
while (fgets(line, 256, fp) != NULL) {
/* Read NFS directory name */
if (!strncmp(line, "device", 6)) {
sw = 0;
- sscanf(line + 6, aux, nfs_name, mount, on);
- if ((!strncmp(mount, "mounted", 7)) && (!strncmp(on, "on", 2))) {
- sw = 1;
+ sscanf(line + 6, aux, nfs_name);
+ mount_part = strchr(line + 7, ' ');
+ if (mount_part != NULL) {
+ sscanf(mount_part, "%10s %10s", mount, on);
+ if ((!strncmp(mount, "mounted", 7)) && (!strncmp(on, "on", 2))) {
+ sw = 1;
+ }
}
}