Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
multipath-tools
multipath-tools-fixes-for-show-paths-format
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File multipath-tools-fixes-for-show-paths-format of Package multipath-tools
From 244454da2d4f3cb5d197a6b0e6fc2b4c8d72d08c Mon Sep 17 00:00:00 2001 From: Christophe Varoqui <christophe.varoqui@free.fr> Date: Mon, 29 Sep 2008 00:44:46 +0200 Subject: [PATCH] [libmultipath] fixes for "show paths format" o undue 1-char rollback when encountering unknown wildcard o fix segfault when format starts with an unknown wildard o continue parsing the format after an unknown wildcard --- libmultipath/print.c | 33 +++++++++++++-------------------- 1 files changed, 13 insertions(+), 20 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index 459b973..7411ccc 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -28,6 +28,9 @@ #define NOPAD s = c #define PAD(x) while ((int)(c - s) < (x) && (c < (line + len - 1))) \ *c++ = ' '; s = c +#define ENDLINE \ + if (c > line) \ + line[c - line - 1] = '\n' #define PRINT(var, size, format, args...) \ fwd = snprintf(var, size, format, ##args); \ c += (fwd >= size) ? size : fwd; @@ -532,15 +535,13 @@ snprint_multipath_header (char * line, int len, char * format) f++; if (!(data = mpd_lookup(*f))) - break; /* unknown wildcard */ + continue; /* unknown wildcard */ PRINT(c, TAIL, data->header); PAD(data->width); } while (*f++); - line[c - line - 1] = '\n'; - line[c - line] = '\0'; - + ENDLINE; return (c - line); } @@ -567,7 +568,7 @@ snprint_multipath (char * line, int len, char * format, f++; if (!(data = mpd_lookup(*f))) - break; + continue; data->snprint(buff, MAX_FIELD_LEN, mpp); PRINT(c, TAIL, buff); @@ -575,9 +576,7 @@ snprint_multipath (char * line, int len, char * format, buff[0] = '\0'; } while (*f++); - line[c - line - 1] = '\n'; - line[c - line] = '\0'; - + ENDLINE; return (c - line); } @@ -602,15 +601,13 @@ snprint_path_header (char * line, int len, char * format) f++; if (!(data = pd_lookup(*f))) - break; /* unknown wildcard */ + continue; /* unknown wildcard */ PRINT(c, TAIL, data->header); PAD(data->width); } while (*f++); - line[c - line - 1] = '\n'; - line[c - line] = '\0'; - + ENDLINE; return (c - line); } @@ -637,16 +634,14 @@ snprint_path (char * line, int len, char * format, f++; if (!(data = pd_lookup(*f))) - break; + continue; data->snprint(buff, MAX_FIELD_LEN, pp); PRINT(c, TAIL, buff); PAD(data->width); } while (*f++); - line[c - line - 1] = '\n'; - line[c - line] = '\0'; - + ENDLINE; return (c - line); } @@ -673,16 +668,14 @@ snprint_pathgroup (char * line, int len, char * format, f++; if (!(data = pgd_lookup(*f))) - break; + continue; data->snprint(buff, MAX_FIELD_LEN, pgp); PRINT(c, TAIL, buff); PAD(data->width); } while (*f++); - line[c - line - 1] = '\n'; - line[c - line] = '\0'; - + ENDLINE; return (c - line); } -- 1.5.2.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor