author | Leibo Wang <Leibo.Wang@Sun.COM> |
Tue, 25 Feb 2014 17:57:53 -0800 | |
branch | s11-update |
changeset 2968 | 3f4acbcf337b |
permissions | -rw-r--r-- |
2968
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
1 |
This patch fixed segfault when supplying multiple options like '-f' for iftop. |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
2 |
The fixing has been integrated into open iftop-1.0 pre-release version. We can |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
3 |
see the fixing log here: |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
4 |
http://www.ex-parrot.com/~pdw/iftop/cvs/iftop/ChangeLog |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
5 |
|
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
6 |
--- cfgfile.c.orig 2013-12-02 00:37:09.851645000 -0800 |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
7 |
+++ cfgfile.c 2013-12-02 00:31:53.734822000 -0800 |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
8 |
@@ -230,8 +230,13 @@ |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
9 |
stringmap S; |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
10 |
|
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
11 |
S = stringmap_find(config, directive); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
12 |
- if (S) stringmap_delete_free(S); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
13 |
- stringmap_insert(config, directive, item_ptr(xstrdup(s))); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
14 |
+ if (S) { |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
15 |
+ xfree(S->d.v); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
16 |
+ S->d = item_ptr(xstrdup(s)); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
17 |
+ } |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
18 |
+ else { |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
19 |
+ stringmap_insert(config, directive, item_ptr(xstrdup(s))); |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
20 |
+ } |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
21 |
} |
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
22 |
|
3f4acbcf337b
17347731 iftop core dumps when using more than one -f option
Leibo Wang <Leibo.Wang@Sun.COM>
parents:
diff
changeset
|
23 |
int read_config(char *file, int whinge_on_error) { |