Skip to content

Commit 8a75248

Browse files
author
David Sommerseth
committed
Fixed typos, more clean up
1 parent 951f87e commit 8a75248

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

python-ethtool/etherinfo.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* General Public License for more details.
1616
*/
1717

18+
#include <Python.h>
1819
#include <bits/sockaddr.h>
1920
#include <stdio.h>
2021
#include <string.h>
@@ -50,7 +51,7 @@ inline struct etherinfo *new_etherinfo_record()
5051
{
5152
struct etherinfo *ptr;
5253

53-
ptr = (struct etherinfo *) malloc(sizeof(struct etherinfo)+1);
54+
ptr = malloc(sizeof(struct etherinfo)+1);
5455
if( ptr ) {
5556
memset(ptr, 0, sizeof(struct etherinfo)+1);
5657
}
@@ -132,12 +133,12 @@ int open_netlink_socket(struct sockaddr_nl *local)
132133

133134
fd = socket(local->nl_family, SOCK_RAW, NETLINK_ROUTE);
134135
if(fd < 0) {
135-
PyErr_SetString(PuExc_OSError, strerror(errno));
136+
PyErr_SetString(PyExc_OSError, strerror(errno));
136137
return -1;
137138
}
138139

139140
if(bind(fd, (struct sockaddr*) local, sizeof(*local)) < 0) {
140-
PyErr_SetString(PuExc_OSError, strerror(errno));
141+
PyErr_SetString(PyExc_OSError, strerror(errno));
141142
return -1;
142143
}
143144

@@ -177,7 +178,7 @@ int send_netlink_query(int fd, int get_type)
177178
msg_info.msg_iovlen = 1;
178179

179180
if( sendmsg(fd, &msg_info, 0) < 0 ) {
180-
PyErr_SetString(PuExc_OSError, strerror(errno));
181+
PyErr_SetString(PyExc_OSError, strerror(errno));
181182
return 0;
182183
}
183184
return 1;
@@ -215,7 +216,7 @@ int read_netlink_results(int fd, struct sockaddr_nl *local,
215216
if (status < 0) {
216217
if (errno == EINTR || errno == EAGAIN)
217218
continue;
218-
PyErr_SetString(PuExc_OSError, strerror(errno));
219+
PyErr_SetString(PyExc_OSError, strerror(errno));
219220
return 0;
220221
}
221222

@@ -242,7 +243,7 @@ int read_netlink_results(int fd, struct sockaddr_nl *local,
242243
fprintf(stderr, "** ERROR ** Error message truncated\n");
243244
} else {
244245
errno = -err->error;
245-
PyErr_SetString(PuExc_OSError, strerror(errno));
246+
PyErr_SetString(PyExc_OSError, strerror(errno));
246247
}
247248
return 0;
248249
}

0 commit comments

Comments
 (0)