diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-05-17 17:59:05 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-05-17 17:59:05 +0200 |
commit | 1c44d404f602a7e477def6572c2f620a6970b244 (patch) | |
tree | 74df9149e4b9a90fa8322c14cdf35fc5d371dce8 | |
parent | 7be675f154e3922fb8e2c9309b48f9fa12869817 (diff) |
wifi_essid: Fix coding style
Only initialize variables at the beginning of a block
-rw-r--r-- | components/wifi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/wifi.c b/components/wifi.c index 7dfa4e2..473c8a7 100644 --- a/components/wifi.c +++ b/components/wifi.c @@ -66,14 +66,14 @@ wifi_essid(const char *iface) { static char id[IW_ESSID_MAX_SIZE+1]; - int sockfd = socket(AF_INET, SOCK_DGRAM, 0); + int sockfd; struct iwreq wreq; memset(&wreq, 0, sizeof(struct iwreq)); wreq.u.essid.length = IW_ESSID_MAX_SIZE+1; snprintf(wreq.ifr_name, sizeof(wreq.ifr_name), "%s", iface); - if (sockfd < 0) { + if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "socket 'AF_INET': %s\n", strerror(errno)); return NULL; |