summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* treewide: Remove useless casts from bind() pointer argument.Ralf Baechle2017-08-032-2/+2
| | | | | | | | | | | | | | | | | | | | | This is using the following semantic patch: @bind@ type T; expression A, C; struct sockaddr *B; @@ - bind(A, (struct sockaddr *) B, C) + bind(A, B, C) @bind_in@ type T; expression A, C; struct sockaddr_in *B; @@ - bind(A, (struct sockaddr *) B, C) + bind(A, B, C) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Remove useless casts of function return value to void.Ralf Baechle2017-08-034-17/+14
| | | | | | | | | | | | | | | | Arguably useful in documenting the return value is intentionally ignored I think it's just cluttering the screen. This is using the following semantic patch: @castvoid@ expression F; @@ - (void) F + F (...) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Remove useless casts from sendto() pointer argument.Ralf Baechle2017-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is using the following semantic patch: @send@ type T; expression A, B, C, D; @@ - send(A, (T *)B, C, D) + send(A, B, C, D) @sendto1@ type T; expression A, B, C, D, E, F; @@ - sendto(A, (T *)B, C, D, E, F) + sendto(A, B, C, D, E, F) @sendto2@ type T; expression A, B, C, D, F; struct sockaddr *E; @@ - sendto(A, B, C, D, (struct sockaddr *) E, F) + sendto(A, B, C, D, E, F) @sendmsg@ type T; expression A, B, C; @@ - sendmsg(A, (T *)B, C) + sendmsg(A, B, C) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Remove useless casts from memset pointer argument.Ralf Baechle2017-08-036-13/+13
| | | | | | | | | | | | | This is using the following semantic patch: @memset@ type T; expression A, B, C; @@ - memset((T *)A, B, C) + memset(A, B, C) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Remove useless casts from memcpy pointer arguments.Ralf Baechle2017-08-034-13/+18
| | | | | | | | | | | | | | | | | | | This is using the following semantic patch: @memcpy1@ type T; expression A, B, C; @@ - memcpy((T *)A, B, C) + memcpy(A, B, C) @memcpy2@ type T; expression A, B, C; @@ - memcpy(A, (T *)B, C) + memcpy(A, B, C) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rip98d: Perform a crapectomy on hex2intrev().Ralf Baechle2017-08-031-46/+4
| | | | | | | | | | | | | hex2intrev is a hilariously complicated function which combine parsing a hexadecimal integer in network byte order and swapping the result to host byte order. Move the endianess swapping to the caller which allows to remove double endianess swapping. Now that hex2intrev no longer deals with byte order rename it to hex2int and replace its implementation with a simple invocation of strtoul. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rip98r: Use unsigned int to store IPv4 addresses and masks.Ralf Baechle2017-08-031-2/+2
| | | | | | Unsigned long is wasteful on 64 bit. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rip98d: Replace naive mask2bits and bits2mask implementations.Ralf Baechle2017-08-032-53/+10
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rip98d: Change bits2mask's return value from unsigned long to unsigned int.Ralf Baechle2017-08-012-2/+2
| | | | | | An IPv4 mask fit into an unsigned int. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rip98d: Change mask2bits's argument from unsigned long to unsigned int.Ralf Baechle2017-08-012-2/+2
| | | | | | An IPv4 address or mask fits into an unsigned int. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* treewide: Kill assignments in if conditions.Ralf Baechle2017-07-3142-219/+439
| | | | | | | | | | | | | | | | | | | | Somewhat hard to read and the code base already has many overlong lines. Found with below spatch file and some manual editing in ax25/access.c to restore a comment lost by spatch. @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axwrapper: Compute nfds argument of select() instead of using a constant.Ralf Baechle2017-07-261-1/+10
| | | | | | | In particular this remove reliance on how file descriptors are assigned and ensures we don't pass an unnecessarily high nfds argument to select. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axwrapper: Remove unused code resulting in warning.Ralf Baechle2017-07-261-7/+0
| | | | | | | | | | | | | | | | | gcc -g -O2 -Wall -o axspawn axspawn.o access.o md5.o -lax25 -lutil gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DAX25_SYSCONFDIR=\""/usr/local/etc/ax25/"\" -DAX25_LOCALSTATEDIR=\""/us r/local/var/ax25/"\" -g -O2 -Wall -MT axwrapper.o -MD -MP -MF .deps/axwrapper.Tpo -c -o axwrapper.o axwrapper.c axwrapper.c:49:13: warning: ‘sigchld_handler’ defined but not used [-Wunused-function] static void sigchld_handler(int sig) ^~~~~~~~~~~~~~~ Since 71918b7d4e95 ("axwrapper: Mark functions sigchld_handler and convert_{cr_lf,lf_cr} static.") made sigchld_handler() static gcc was warning about the function being unused. No point in keeping this around; SIGCHLD is perfectly fine. Fixes: 71918b7d4e95 ("axwrapper: Mark functions sigchld_handler and convert_{cr_lf,lf_cr} static.") Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axwrapper: Handle EINTR error return from select().Ralf Baechle2017-07-261-0/+3
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axwrapper: Delete FILES section from man page.Ralf Baechle2017-07-261-1/+0
| | | | | | No files were listed in the FILES section. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* kissnetd: Fix possible buffer overflow.Ralf Baechle2017-07-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When printing an error message for configurations using particularly long file names a buffer overflow may occur potencially resulting in malfunction or crash. This fixes the following GCC 7.1.1 warnings: gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DAX25_SYSCONFDIR=\""/usr/local/etc/ax25/"\" -DAX25_LOCALSTATEDIR=\""/us r/local/var/ax25/"\" -g -O2 -Wall -MT kissnetd.o -MD -MP -MF .deps/kissnetd.Tpo -c -o kissnetd.o kissnetd.c kissnetd.c: In function ‘main’: kissnetd.c:124:38: warning: ‘%s’ directive writing up to 4095 bytes into a region of size 66 [-Wformat-overflow=] sprintf(MyString, "cannot reopen %s", PortList[PortNumber]->Name); ^~ kissnetd.c:124:5: note: ‘sprintf’ output between 15 and 4110 bytes into a destination of size 80 sprintf(MyString, "cannot reopen %s", PortList[PortNumber]->Name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kissnetd.c:143:49: warning: ‘%s’ directive writing up to 4095 bytes into a region of size 55 [-Wformat-overflow=] sprintf(MyString, "Cannot unlock pts-device %s\n", PortList[PortNumber]->namepts); ^~ kissnetd.c:143:5: note: ‘sprintf’ output between 27 and 4122 bytes into a destination of size 80 sprintf(MyString, "Cannot unlock pts-device %s\n", PortList[PortNumber]->namepts); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kissnetd.c:154:50: warning: ‘%s’ directive writing up to 4095 bytes into a region of size 54 [-Wformat-overflow=] sprintf(MyString, "cannot reopen ptmx (slave %s).", PortList[PortNumber]->namepts); ^~ kissnetd.c:154:5: note: ‘sprintf’ output between 29 and 4124 bytes into a destination of size 80 sprintf(MyString, "cannot reopen ptmx (slave %s).", PortList[PortNumber]->namepts); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* ax25: Delete useless casts of malloc's return value.Ralf Baechle2017-02-062-17/+17
| | | | | | | | | | | | | | | malloc returns a void pointer so no cast is necessary when assigning to a pointer type. Found with below coccinelle script: @malloccast@ type T; @@ - (T *) malloc(...) Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Don't check for negative return from strlen.Ralf Baechle2017-02-061-1/+1
| | | | | | | | For one strlen does not return any errors. By its very nature strlen does not return negative results and its return type is size_t which happens to be unsigned. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* mheard: Drop unsatisfiable conditions.Ralf Baechle2017-02-061-2/+2
| | | | | | | | | | | | | | gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DAX25_SYSCONFDIR=\""/usr/local/etc/ax25/"\" -DAX25_LOCALSTATEDIR=\""/usr/local/var/ax25/"\" -O2 -Wall -Wextra -MT mheard.o -MD -MP -MF .deps/mheard.Tpo -c -o mheard.o mheard.c [...] mheard.c:135:22: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (pr->entry.type < 0 || pr->entry.type > sizeof(types)) ^ mheard.c:168:22: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (pr->entry.type < 0 || pr->entry.type > sizeof(types)) ^ [...] Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* netromd: Add cast to fix warning.Ralf Baechle2017-02-061-1/+1
| | | | | | | | | | | | | | | gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DAX25_SYSCONFDIR=\""/usr/local/etc/ax25/"\" -DAX25_LOCALSTATEDIR=\""/usr/local/va r/ax25/"\" -O2 -Wall -pedantic -MT netromt.o -MD -MP -MF .deps/netromt.Tpo -c -o netromt.o netromt.c In file included from netromt.c:24:0: netromt.c: In function ‘build_header’: netromd.h:10:19: warning: overflow in implicit constant conversion [-Woverflow] #define NODES_SIG 0xFF ^ netromt.c:28:15: note: in expansion of macro ‘NODES_SIG’ message[0] = NODES_SIG; ^~~~~~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* mkiss: Change type of buffer[] to fix warning.Ralf Baechle2017-02-061-1/+1
| | | | | | | | | | | | | | | | | | | gcc -DHAVE_CONFIG_H -I. -I.. -D_GNU_SOURCE -DAX25_SYSCONFDIR=\""/usr/local/etc/ax25/"\" -DAX25_LOCALSTATEDIR=\""/usr/local/var/ax25/"\" -O2 -Wall -pedantic -MT mkiss.o -MD -MP -MF .deps/mkiss.Tpo -c -o mkiss.o mkiss.c mkiss.c: In function ‘poll’: mkiss.c:67:15: warning: overflow in implicit constant conversion [-Woverflow] #define FEND 0300 /* Frame End (0xC0) */ ^ mkiss.c:148:14: note: in expansion of macro ‘FEND’ buffer[0] = FEND; ^~~~ mkiss.c:67:15: warning: overflow in implicit constant conversion [-Woverflow] #define FEND 0300 /* Frame End (0xC0) */ ^ mkiss.c:150:14: note: in expansion of macro ‘FEND’ buffer[2] = FEND; ^~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsdwnlnk: Add cast to silence useless warning.Ralf Baechle2017-02-061-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: Fix warning and add error check to getuptime call.Ralf Baechle2017-02-061-1/+5
| | | | | | | | | rsmemsiz.c: In function ‘main’: rsmemsiz.c:139:11: warning: ‘uptime_secs’ may be used uninitialized in this function [-Wmaybe-uninitialized] updays = (int) uptime_secs / (60*60*24); ^~~~~~~~~~~~~~~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsuplnk: Add cast to silence useless warning.Ralf Baechle2017-02-061-1/+1
| | | | | | | | | rsuplnk.c: In function ‘main’: rsuplnk.c:262:17: warning: overflow in implicit constant conversion [-Woverflow] buffer[0] = 0xF0; ^~~~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* user_call: Fix warning about void pointer arithmetic.Ralf Baechle2017-02-061-2/+3
| | | | | | | | | | user_io.c user_io.c: In function ‘flush_output’: user_io.c:70:7: warning: pointer of type ‘void *’ used in arithmetic [-Wpointer-arith] buf += paclen_out; ^~ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: Rewrite the last instance of FILE_TO_BUF().Ralf Baechle2017-02-061-28/+25
| | | | | | | Expand the one remaining invocation to FILE_TO_BUF(), then fix the return type and attempt to close fd -1 and format nicely. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: Delete now unused macro SET_IF_DESIRED.Ralf Baechle2017-02-061-2/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: Use sysinfo to obtain uptime.Ralf Baechle2017-02-061-9/+9
| | | | | | | Now that uptime() is only used to obtain the load average it's trivial to replace. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: When parsing /proc/uptime, ignore idle time.Ralf Baechle2017-02-061-6/+5
| | | | | | We don't use this information anyway later on. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* rsmemsiz: Use standard libc function to get load average.Ralf Baechle2017-02-061-16/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* ttylinkd: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-3/+3
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* ax25d: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-2/+2
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axwrapper: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-2/+2
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* mkiss: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-3/+3
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-6/+6
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-11/+12
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-7/+7
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* mheard: Fix use of 0 instead of NULL as a pointer value.Ralf Baechle2017-02-061-5/+5
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Make function calc_crc static.Ralf Baechle2017-02-061-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Include util.h into utilc for the prototypes.Ralf Baechle2017-02-061-0/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Make do_version static.Ralf Baechle2017-02-061-1/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axgetput: Move definition of several array from a .h to a .c file.Ralf Baechle2017-02-062-3/+7
| | | | | | And add proper declarations to the header file. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* ax25d: Reorder code to avoid the need for forward declarations.Ralf Baechle2017-02-061-461/+454
| | | | | | And then delete those now useless declarations. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* ax25d: Make several functions static.Ralf Baechle2017-02-061-4/+7
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axparms: Make several functions static.Ralf Baechle2017-02-061-9/+9
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Remove unused function Xtoupper().Ralf Baechle2017-02-061-9/+0
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Sort out homebrew declaration of forkpty(3).Ralf Baechle2017-02-061-9/+1
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Make many functions and variables static.Ralf Baechle2017-02-061-42/+38
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
* axspawn: Move calc_md5_pw to eleminate need for declaration and make static.Ralf Baechle2017-02-061-30/+29
| | | | Signed-off-by: Ralf Baechle <ralf@linux-mips.org>