projects
/
platform
/
core
/
system
/
batterymonitor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
21cf8f5
)
Initialize optind before getopt
68/227368/1
author
Kichan Kwon
<k_c.kwon@samsung.com>
Fri, 6 Mar 2020 03:02:04 +0000
(12:02 +0900)
committer
Dewal Agarwal
<d1.agarwal@samsung.com>
Wed, 11 Mar 2020 11:38:32 +0000
(11:38 +0000)
- getopt doesn't initialize optind
- So, we must reset it on each subsequent call
Change-Id: I4f5bd874a8daeef12d7234a21e6975e9cbe7c846
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
(cherry picked from commit
27f62eeb0271c97ebcbf0cf2e347ac727a6c20d5
)
src/battery_dump/bd_history_item.c
patch
|
blob
|
history
diff --git
a/src/battery_dump/bd_history_item.c
b/src/battery_dump/bd_history_item.c
index
4dfbf84
..
6957e16
100644
(file)
--- a/
src/battery_dump/bd_history_item.c
+++ b/
src/battery_dump/bd_history_item.c
@@
-1315,6
+1315,11
@@
int bd_callback(const int fd, const int argc, char **argv)
int opt;
bool checkin = false;
+ /**
+ * We must reset optind because it isn't initialized
+ * on subsequent getopt calls
+ */
+ optind = 1;
while ((opt = getopt(argc, argv, "c")) != -1) {
switch (opt) {
case 'c':