1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-05 21:07:52 +00:00

Stepan Zastupov's "fucking patch" (that's how he identifies it

himself) for WiFi stuff. Basicly, we use strlcpy() instead of
strncpy(). strlcpy() is avaible since FreeBSD 3.3 and on
Debian/kFreeBSD and simular systems it's possible to install
a third party lib to get a support for it (if somebody cares).


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@712 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Roman Bogorodskiy 2006-10-19 18:52:14 +00:00
parent 00e92953b6
commit a5de2b09d9

View File

@ -563,8 +563,7 @@ update_wifi_stats()
/* Get media type */ /* Get media type */
bzero(&ifmr, sizeof(ifmr)); bzero(&ifmr, sizeof(ifmr));
strncpy(ifmr.ifm_name, ifa->ifa_name, strlen(ifmr.ifm_name) - 1); strlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);
ifmr.ifm_name[sizeof(ifmr.ifm_name) - 1] = '\0';
if (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) { if (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) {
perror("ioctl (getting media type)"); perror("ioctl (getting media type)");
exit(1); exit(1);
@ -577,8 +576,7 @@ update_wifi_stats()
!(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) { !(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {
/* Get wi status */ /* Get wi status */
bzero(&ifr, sizeof(ifr)); bzero(&ifr, sizeof(ifr));
strncpy(ifr.ifr_name, ifa->ifa_name, strlen(ifr.ifr_name) - 1); strlcpy(ifr.ifr_name, ifa->ifa_name, IFNAMSIZ);
ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
wireq.wi_type = WI_RID_COMMS_QUALITY; wireq.wi_type = WI_RID_COMMS_QUALITY;
wireq.wi_len = WI_MAX_DATALEN; wireq.wi_len = WI_MAX_DATALEN;
ifr.ifr_data = (void *) &wireq; ifr.ifr_data = (void *) &wireq;