Files
linamh/app-misc/irtrans-irserver/files/irtrans-irserver-6.10.23-musl.patch
2026-04-10 02:22:07 +02:00

565 lines
14 KiB
Diff

diff '--color=auto' -uNr work.orig/ascii.c work/ascii.c
--- work.orig/ascii.c 2026-04-10 01:49:57.727751381 +0200
+++ work/ascii.c 2026-04-10 01:52:46.077657933 +0200
@@ -62,6 +62,7 @@
#include <stdint.h>
#include <time.h>
#include <unistd.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
@@ -785,10 +786,8 @@
#endif
#ifdef LINUX
- int fd,pos,lend;
- off64_t off = 0;
- struct dirent64 *di;
- char mem[2048];
+ DIR *dir;
+ struct dirent *di;
#endif
while (*command == ' ') command++;
@@ -820,33 +819,29 @@
#endif
#ifdef LINUX
- fd = open ("../html",0);
- do {
- lend = getdirentries64 (fd,mem,2048,&off);
- pos = 0;
- while (pos < lend) {
- di = (struct dirent64 *)&mem[pos];
-
- sprintf (fname,"../html/%s",di->d_name);
- fp = fopen (fname,"r");
- if (fp && !fstat (fileno(fp),&fst) && S_ISREG (fst.st_mode)) {
- strncpy (result+len,di->d_name,22);
- strcat (result,";");
-
- atime = localtime (&fst.st_mtime);
- sprintf (st,"%d;%02d.%02d.%04d %02d:%02d;",fst.st_size,atime->tm_mday,atime->tm_mon+1,atime->tm_year + 1900,atime->tm_hour,atime->tm_min);
- strcat (result,st);
-
- len = strlen (result);
- cnt++;
- fclose (fp);
- }
-
- pos += di -> d_reclen;
- }
- } while (lend);
+ dir = opendir("../html");
+ if (dir) {
+ while ((di = readdir(dir)) != NULL) {
+ sprintf(fname, "../html/%s", di->d_name);
+ fp = fopen(fname, "r");
+ if (fp && !fstat(fileno(fp), &fst) && S_ISREG(fst.st_mode)) {
+ strncpy(result + len, di->d_name, 22);
+ strcat(result, ";");
+
+ atime = localtime(&fst.st_mtime);
+ sprintf(st, "%ld;%02d.%02d.%04d %02d:%02d;",
+ (long)fst.st_size,
+ atime->tm_mday, atime->tm_mon + 1, atime->tm_year + 1900,
+ atime->tm_hour, atime->tm_min);
+ strcat(result, st);
- close (fd);
+ len = strlen(result);
+ cnt++;
+ fclose(fp);
+ }
+ }
+ closedir(dir);
+ }
#endif
strcat (result,"\n");
diff '--color=auto' -uNr work.orig/errormessage.c work/errormessage.c
--- work.orig/errormessage.c 2026-04-10 01:49:57.726577359 +0200
+++ work/errormessage.c 2026-04-10 01:50:23.442990590 +0200
@@ -60,6 +60,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include "remote.h"
#include "network.h"
diff '--color=auto' -uNr work.orig/fileio.c work/fileio.c
--- work.orig/fileio.c 2026-04-10 01:49:57.727751381 +0200
+++ work/fileio.c 2026-04-10 01:50:23.443154639 +0200
@@ -63,6 +63,7 @@
#include <stdint.h>
#include <unistd.h>
#include <ctype.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
@@ -88,63 +89,52 @@
extern byte rcmmflag;
-#ifdef LINUX
-
+#ifdef LINUX
int ReadIRTransDirectory (char filetype[],REMOTEBUFFER *buf,int start,byte statustype)
{
+ DIR *dir;
+ struct dirent *di;
+ int fl, dlen;
+ int cnt, cnt_total, nlen;
+
+ memset(buf, 0, sizeof(REMOTEBUFFER));
+ buf->statustype = statustype;
+ buf->statuslen = sizeof(REMOTEBUFFER);
+ buf->offset = (short)start;
+
+ if (statustype == STATUS_IRDBFILE) dlen = 5;
+ else dlen = 4;
+
+ dir = opendir(".");
+ if (!dir) return -1;
+
+ cnt = cnt_total = 0;
+
+ while ((di = readdir(dir)) != NULL) {
+ fl = (int)strlen(di->d_name) - dlen;
+ if (fl >= 1 && !strcmp(di->d_name + fl, filetype)) {
+ if (cnt_total >= start && cnt < 40) {
+ nlen = (int)strlen(di->d_name) - dlen;
+ if (nlen > 80) nlen = 80;
+ memset(buf->remotes[cnt].name, ' ', 80);
+ memcpy(buf->remotes[cnt].name, di->d_name, nlen);
+ cnt++;
+ }
+ cnt_total++;
+ }
+ }
+
+ buf->count_buffer = cnt;
+ buf->count_total = cnt_total;
+ if (cnt == 40) buf->count_remaining = cnt_total - cnt;
+ else buf->count_remaining = 0;
- int fd,i,len,pos,res,fl,dlen;
- off64_t off = 0;
- char st[2048],msg[256];
- struct dirent64 *di;
-
- int cnt,cnt_total,nlen;
- memset (buf,0,sizeof (REMOTEBUFFER));
- buf->statustype = statustype;
- buf->statuslen = sizeof (REMOTEBUFFER);
- buf->offset = (short)start;
-
- if (statustype == STATUS_IRDBFILE) dlen = 5;
- else dlen = 4;
-
- fd = open (".",0);
-
- cnt = cnt_total = 0;
-
- do {
- len = getdirentries64 (fd,st,2048,&off);
-
- pos = 0;
- while (pos < len) {
- di = (struct dirent64 *)&st[pos];
- fl = strlen (di -> d_name) - dlen;
- if (fl >= 1 && !strcmp (di->d_name + fl,filetype)) {
- if (cnt_total >= start && cnt < 40) {
- nlen = strlen (di -> d_name) - dlen;
- if (nlen > 80) nlen = 80;
- memset (buf->remotes[cnt].name,' ',80);
- memcpy (buf->remotes[cnt].name,di -> d_name,nlen);
- cnt++;
- }
- cnt_total++;
- }
- pos += di -> d_reclen;
- }
- } while (len);
-
- buf->count_buffer = cnt;
- buf->count_total = cnt_total;
- if (cnt == 40) buf->count_remaining = cnt_total-cnt;
- else buf->count_remaining = 0;
-
- close (fd);
- return (0);
+ closedir(dir);
+ return 0;
}
-
#endif
-
#ifdef WIN32
int ReadIRTransDirectory (char filetype[],REMOTEBUFFER *buf,int start,byte statustype)
diff '--color=auto' -uNr work.orig/firmware.c work/firmware.c
--- work.orig/firmware.c 2026-04-10 01:49:57.727751381 +0200
+++ work/firmware.c 2026-04-10 01:50:23.443361495 +0200
@@ -250,60 +250,49 @@
buf->offset = start;
cnt = cnt_total = 0;
-#ifdef LINUX
-
- if (!start) {
- GetHardwareType (bus);
- //printf ("Type: %d\n",IRDevices[bus].fw_capabilities4);
-
- GetFirmwarePath (path);
- fd = open ("../Firmware",0);
-
- do {
- len = getdirentries64 (fd,st,2048,&off);
-
- pos = 0;
- while (pos < len) {
- di = (struct dirent64 *)&st[pos];
- cnt_total++;
- pos += di -> d_reclen;
- }
- } while (len);
-
- if (stat_fw_pnt) free (stat_fw_pnt);
- stat_fw_pnt = malloc (cnt_total * sizeof (FIRMWARELINE));
- firmware_file_cnt = 0;
-
- lseek (fd,0,SEEK_SET);
-
- do {
- len = getdirentries64 (fd,st,2048,&off);
-
- pos = 0;
- while (pos < len) {
- di = (struct dirent64 *)&st[pos];
-
- res = GetFirmwareInfo (path,di -> d_name,bus,&info);
- if (res != ERR_OPEN) {
- if (cnt_total >= start && cnt < 40) {
- strcpy (stat_fw_pnt[cnt].filename,di -> d_name);
- strcpy (stat_fw_pnt[cnt].ir_version,info.ir_version);
- strcpy (stat_fw_pnt[cnt].lan_version,info.net_version);
- strcpy (stat_fw_pnt[cnt].devicetype,info.devicetype);
- stat_fw_pnt[cnt].firmware_flags = info.firmware_flag;
- stat_fw_pnt[cnt].net_flag = info.net_type;
- cnt++;
- }
- }
- pos += di -> d_reclen;
- }
- } while (len);
+#ifdef LINUX
+ if (!start) {
+ DIR *dir;
+ struct dirent *di;
+
+ GetHardwareType(bus);
+ GetFirmwarePath(path);
+
+ dir = opendir("../Firmware");
+ if (!dir) return ERR_OPEN;
+
+ cnt_total = 0;
+ while ((di = readdir(dir)) != NULL) {
+ cnt_total++;
+ }
+ closedir(dir);
- close (fd);
- firmware_file_cnt = cnt;
+ if (stat_fw_pnt) free(stat_fw_pnt);
+ stat_fw_pnt = malloc(cnt_total * sizeof(FIRMWARELINE));
+ firmware_file_cnt = 0;
+
+ dir = opendir("../Firmware");
+ if (!dir) return ERR_OPEN;
+
+ while ((di = readdir(dir)) != NULL) {
+ res = GetFirmwareInfo(path, di->d_name, bus, &info);
+ if (res != ERR_OPEN) {
+ if (cnt_total >= start && cnt < 40) {
+ strcpy(stat_fw_pnt[cnt].filename, di->d_name);
+ strcpy(stat_fw_pnt[cnt].ir_version, info.ir_version);
+ strcpy(stat_fw_pnt[cnt].lan_version, info.net_version);
+ strcpy(stat_fw_pnt[cnt].devicetype, info.devicetype);
+ stat_fw_pnt[cnt].firmware_flags = info.firmware_flag;
+ stat_fw_pnt[cnt].net_flag = info.net_type;
+ cnt++;
+ }
+ }
}
+ closedir(dir);
+ firmware_file_cnt = cnt;
+ }
#endif
#ifdef WIN32
diff '--color=auto' -uNr work.orig/flashrom.c work/flashrom.c
--- work.orig/flashrom.c 2026-04-10 01:49:57.727751381 +0200
+++ work/flashrom.c 2026-04-10 01:50:23.443537587 +0200
@@ -50,6 +50,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include "remote.h"
#include "errcode.h"
diff '--color=auto' -uNr work.orig/lanio.c work/lanio.c
--- work.orig/lanio.c 2026-04-10 01:49:57.727751381 +0200
+++ work/lanio.c 2026-04-10 01:50:23.443678410 +0200
@@ -62,6 +62,7 @@
#include <sys/timeb.h>
#include <unistd.h>
#include <time.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
diff '--color=auto' -uNr work.orig/linuxserio.c work/linuxserio.c
--- work.orig/linuxserio.c 2026-04-10 01:49:57.727751381 +0200
+++ work/linuxserio.c 2026-04-10 01:50:23.443761792 +0200
@@ -44,6 +44,7 @@
#include <sys/un.h>
#include <arpa/inet.h>
#include <stdlib.h>
+#include <string.h>
#include "remote.h"
#include "errcode.h"
diff '--color=auto' -uNr work.orig/lowlevel.c work/lowlevel.c
--- work.orig/lowlevel.c 2026-04-10 01:49:57.727751381 +0200
+++ work/lowlevel.c 2026-04-10 01:50:23.443969825 +0200
@@ -67,6 +67,7 @@
#include <sys/time.h>
#include <netdb.h>
#include <unistd.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
diff '--color=auto' -uNr work.orig/mce.c work/mce.c
--- work.orig/mce.c 2026-04-10 01:49:57.726577359 +0200
+++ work/mce.c 2026-04-10 01:50:23.444228140 +0200
@@ -61,6 +61,7 @@
#include <fcntl.h>
#include <signal.h>
#include <stdint.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
diff '--color=auto' -uNr work.orig/server.c work/server.c
--- work.orig/server.c 2026-04-10 01:49:57.727751381 +0200
+++ work/server.c 2026-04-10 01:51:24.659575143 +0200
@@ -77,6 +77,7 @@
#include <stdint.h>
#include <sys/utsname.h>
#include <unistd.h>
+#include <string.h>
typedef int DWORD;
@@ -1545,7 +1546,6 @@
fclose (stdin);
fclose (stdout);
fclose (stderr);
- stderr = NULL;
setsid ();
fp = fopen ("/tmp/.irserver.pid","w");
if (fp) {
@@ -3024,93 +3024,69 @@
int ReadIRDatabase (void)
{
+ int res, fl;
+ char st[2048], msg[256];
+ DIR *dir;
+ struct dirent *di;
+ char *home = getenv("HOME");
+ char *rdir = getenv("IRTRANS_REMOTES");
+
+ if (irdb_path[0]) {
+ if (chdir(irdb_path)) {
+ sprintf(msg, "Error opening remote database %s\n", irdb_path);
+ log_print(msg, LOG_FATAL);
+ return ERR_NODATABASE;
+ }
+ }
+ else if (rdir) {
+ if (chdir(rdir)) {
+ sprintf(msg, "Error opening remote database %s\n", rdir);
+ log_print(msg, LOG_FATAL);
+ return ERR_NODATABASE;
+ }
+ }
+ else {
+ if (home)
+ snprintf(st, sizeof(st), "%s/.irtrans/remotes", home);
+
+ if (IRDataBaseRead) FreeDatabaseMemory();
+ else if (chdir("./remotes")
+ && !(home && chdir(st) == 0)
+ && chdir("/etc/irserver/remotes")
+ && chdir("/usr/local/share/irtrans/remotes")
+ && chdir("/usr/share/irtrans/remotes"))
+ return ERR_NODATABASE;
+ }
- int fd,i,len,pos,res,fl;
- off64_t off = 0;
- char st[2048],msg[256];
- struct dirent64 *di;
- char *home = getenv("HOME");
- char *rdir = getenv("IRTRANS_REMOTES");
-
- if (irdb_path[0]) {
- if (chdir (irdb_path)) {
- sprintf (msg,"Error opening remote database %s\n",irdb_path);
- log_print (msg,LOG_FATAL);
- return (ERR_NODATABASE);
- }
- }
- else if (rdir) {
- if (chdir (rdir)) {
- sprintf (msg,"Error opening remote database %s\n",rdir);
- log_print (msg,LOG_FATAL);
-
- return (ERR_NODATABASE);
- }
- }
-
- else {
- if (home)
- snprintf(st, sizeof(st), "%s/.irtrans/remotes", home);
-
- if (IRDataBaseRead) FreeDatabaseMemory ();
-
- else if (chdir ("./remotes")
- && !(home && chdir (st) == 0)
- && chdir ("/etc/irserver/remotes")
- && chdir ("/usr/local/share/irtrans/remotes")
- && chdir ("/usr/share/irtrans/remotes")) return (ERR_NODATABASE);
- }
-
- sprintf (msg,"Chdir to DB OK\n");
- log_print (msg,LOG_DEBUG);
-
- ReadRoutingTable ();
-
- sprintf (msg,"Read routing OK\n");
- log_print (msg,LOG_DEBUG);
-
- ReadSwitches ();
-
- sprintf (msg,"Read Switches OK\n");
- log_print (msg,LOG_DEBUG);
-
- fd = open (".",0);
+ sprintf(msg, "Chdir to DB OK\n");
+ log_print(msg, LOG_DEBUG);
- sprintf (msg,"Open DIR: %d\n",fd);
- log_print (msg,LOG_DEBUG);
+ ReadRoutingTable();
+ ReadSwitches();
- do {
- len = getdirentries64 (fd,st,2048,&off);
-
- sprintf (msg,"Get Dirent: %d\n",len);
- log_print (msg,LOG_DEBUG);
-
- pos = 0;
- while (pos < len) {
- di = (struct dirent64 *)&st[pos];
- fl = strlen (di -> d_name) - 4;
- if (fl >= 1 && !strcmp (di->d_name + fl,".rem")) {
- res = DBReadCommandFile (di->d_name);
- if (res) {
- sprintf (msg,"Error %d reading DB-File %s\n",res,di->d_name);
- log_print (msg,LOG_ERROR);
- }
- }
- pos += di -> d_reclen;
- }
- } while (len);
+ dir = opendir(".");
+ if (!dir) return ERR_NODATABASE;
- close (fd);
+ while ((di = readdir(dir)) != NULL) {
+ fl = (int)strlen(di->d_name) - 4;
+ if (fl >= 1 && !strcmp(di->d_name + fl, ".rem")) {
+ res = DBReadCommandFile(di->d_name);
+ if (res) {
+ sprintf(msg, "Error %d reading DB-File %s\n", res, di->d_name);
+ log_print(msg, LOG_ERROR);
+ }
+ }
+ }
- res = DBReferenceLinks ();
+ closedir(dir);
- DBShowStatus ();
- ReadAppConfig ();
+ res = DBReferenceLinks();
+ DBShowStatus();
+ ReadAppConfig();
- IRDataBaseRead = 1;
- return (0);
+ IRDataBaseRead = 1;
+ return 0;
}
-
#endif
#endif
diff '--color=auto' -uNr work.orig/webserver.c work/webserver.c
--- work.orig/webserver.c 2026-04-10 01:49:57.727751381 +0200
+++ work/webserver.c 2026-04-10 01:50:23.450901729 +0200
@@ -58,6 +58,7 @@
#include <signal.h>
#include <stdint.h>
#include <unistd.h>
+#include <string.h>
typedef int DWORD;
#define closesocket close
diff '--color=auto' -uNr work.orig/xap.c work/xap.c
--- work.orig/xap.c 2026-04-10 01:49:57.727751381 +0200
+++ work/xap.c 2026-04-10 01:50:23.451007562 +0200
@@ -57,6 +57,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#ifdef LINUX
#include <time.h>
diff '--color=auto' -uNr work.orig/xbmc.c work/xbmc.c
--- work.orig/xbmc.c 2026-04-10 01:49:57.727751381 +0200
+++ work/xbmc.c 2026-04-10 01:50:23.451090784 +0200
@@ -46,6 +46,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#ifdef LINUX