summaryrefslogtreecommitdiffstats
path: root/filescan-utils.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-04 14:35:48 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-09-04 14:35:48 +0200
commitd8f02a120fc1c9a6b42d1c097c6fe1027d1215be (patch)
tree6a672d023483bf5ed87662774715147168d97367 /filescan-utils.c
parentbe1205fd4ab6bd20dd9bc44ed63c35d999ece761 (diff)
Reduce scope for some variables
Change-Id: Ic89421054a83709eec6afaa22dbb4373bcff9b19 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'filescan-utils.c')
-rw-r--r--filescan-utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/filescan-utils.c b/filescan-utils.c
index 3eb1b50..dbbccc3 100644
--- a/filescan-utils.c
+++ b/filescan-utils.c
@@ -89,8 +89,8 @@ PUBLIC const char *GetMidleName(const char*name) {
char *fullname = strdup(name);
for (int idx = 0; fullname[idx] != '\0'; idx++) {
- int start;
if (fullname[idx] == '-') {
+ int start;
start = idx + 1;
for (int jdx = start; ; jdx++) {
if (fullname[jdx] == '-' || fullname[jdx] == '.' || fullname[jdx] == '\0') {
@@ -106,13 +106,13 @@ PUBLIC const char *GetMidleName(const char*name) {
}
PUBLIC const char *GetBinderName() {
- char psName[17];
static char *binderName=NULL;
if (binderName) return binderName;
binderName= getenv("AFB_BINDER_NAME");
if (!binderName) {
+ char psName[17];
// retrieve binder name from process name afb-name-trailer
prctl(PR_GET_NAME, psName,NULL,NULL,NULL);
binderName=(char*)GetMidleName(psName);