Changeset 420 for branches/merlin
- Timestamp:
- 09/04/09 20:36:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/merlin/src/oscam.c
r419 r420 169 169 } 170 170 sprintf(buf, "%s-%s-%s", CS_OS_CPU, hw, CS_OS_SYS); 171 return (buf);171 return buf; 172 172 } 173 173 … … 204 204 switch (fork()) { 205 205 case -1: 206 return (-1);206 return -1; 207 207 case 0: 208 208 break; … … 212 212 213 213 if (setsid() == (-1)) 214 return (-1);214 return -1; 215 215 216 216 if (!nochdir) … … 224 224 (void) close(fd); 225 225 } 226 return (0);226 return 0; 227 227 } 228 228 #else … … 240 240 241 241 if (!pfd) 242 return (-9);242 return -9; 243 243 if (!read(pfd, buf, 3)) 244 244 oscam_exit(1); … … 248 248 } 249 249 memcpy(&n, buf + 1, 2); 250 return (read(pfd, buf, n));250 return read(pfd, buf, n); 251 251 } 252 252 … … 254 254 { 255 255 if (client[idx].usr[0]) 256 return (client[idx].usr);256 return client[idx].usr; 257 257 else 258 return ("anonymous");258 return "anonymous"; 259 259 } 260 260 … … 266 266 if ((client[i].ip == ip) && (client[i].port == port) && ((client[i].typ == 'c') || (client[i].typ == 'm'))) 267 267 idx = i; 268 return (idx); 268 269 return idx; 269 270 } 270 271 … … 808 809 if (!ph->ptab->ports[port_idx].s_port) { 809 810 log_normal("%s: disabled", ph->desc); 810 return (0);811 return 0; 811 812 } 812 813 is_udp = (ph->type == MOD_CONN_UDP); … … 828 829 else { 829 830 log_normal("%s: Bad port %d", ph->desc, ph->ptab->ports[port_idx].s_port); 830 return (0);831 return 0; 831 832 } 832 833 … … 840 841 if ((ph->ptab->ports[port_idx].fd = socket(PF_INET, is_udp ? SOCK_DGRAM : SOCK_STREAM, ov)) < 0) { 841 842 log_normal("%s: Cannot create socket (errno=%d)", ph->desc, errno); 842 return (0);843 return 0; 843 844 } 844 845 … … 847 848 log_normal("%s: setsockopt failed (errno=%d)", ph->desc, errno); 848 849 close(ph->ptab->ports[port_idx].fd); 849 return (ph->ptab->ports[port_idx].fd = 0);850 return (ph->ptab->ports[port_idx].fd == 0); 850 851 } 851 852 #ifdef SO_REUSEPORT … … 873 874 log_normal("%s: Bind request failed, giving up", ph->desc); 874 875 close(ph->ptab->ports[port_idx].fd); 875 return (ph->ptab->ports[port_idx].fd = 0);876 return (ph->ptab->ports[port_idx].fd == 0); 876 877 } 877 878 } else … … 883 884 log_normal("%s: Cannot start listen mode (errno=%d)", ph->desc, errno); 884 885 close(ph->ptab->ports[port_idx].fd); 885 return (ph->ptab->ports[port_idx].fd = 0);886 return (ph->ptab->ports[port_idx].fd == 0); 886 887 } 887 888 … … 895 896 log_normal("provid #%d: %06X", j, ph->ptab->ports[port_idx].ftab.filts[i].prids[j]); 896 897 } 897 return (ph->ptab->ports[port_idx].fd); 898 899 return ph->ptab->ports[port_idx].fd; 898 900 } 899 901 … … 1223 1225 // printf("WRITE_START pid=%d", getpid()); fflush(stdout); 1224 1226 if ((id < 0) || (id > PIP_ID_MAX)) 1225 return (PIP_ID_ERR);1227 return PIP_ID_ERR; 1226 1228 memcpy(buf, PIP_ID_TXT[id], 3); 1227 1229 memcpy(buf + 3, &n, sizeof (int)); … … 1233 1235 if (!fd) 1234 1236 log_normal("oscam_write_to_pipe: fd==0"); 1235 return (write(fd, buf, n)); 1237 1238 return write(fd, buf, n); 1236 1239 } 1237 1240 … … 1290 1293 } 1291 1294 if (!oscam_bytes_available(fd)) 1292 return (PIP_ID_NUL);1295 return PIP_ID_NUL; 1293 1296 hdr = 0; 1294 1297 if (read(fd, buf + 3 + sizeof (int), l) == l) … … 1296 1299 else { 1297 1300 log_normal("WARNING: pipe data to small !"); 1298 return (PIP_ID_ERR);1301 return PIP_ID_ERR; 1299 1302 } 1300 1303 buf[l + 3 + sizeof (int)] = 0; … … 1319 1322 static int oscam_write_ecm_request(int fd, ECM_REQUEST * er) 1320 1323 { 1321 return (oscam_write_to_pipe(fd, PIP_ID_ECM, (uchar *) er, sizeof (ECM_REQUEST)));1324 return oscam_write_to_pipe(fd, PIP_ID_ECM, (uchar *) er, sizeof (ECM_REQUEST)); 1322 1325 } 1323 1326 … … 1325 1328 static int oscam_write_ecm_dcw(int fd, ECM_REQUEST * er) 1326 1329 { 1327 return (oscam_write_to_pipe(fd, PIP_ID_DCW, (uchar *) er, sizeof (ECM_REQUEST)));1330 return oscam_write_to_pipe(fd, PIP_ID_DCW, (uchar *) er, sizeof (ECM_REQUEST)); 1328 1331 } 1329 1332 */ … … 1426 1429 } 1427 1430 1428 return (oscam_write_ecm_request(fd, er));1431 return oscam_write_ecm_request(fd, er); 1429 1432 } 1430 1433 … … 1437 1440 1438 1441 if (!fd) 1439 return (-1);1442 return -1; 1440 1443 tv.tv_sec = msec / 1000; 1441 1444 tv.tv_usec = (msec % 1000) * 1000; … … 1450 1453 rc = -1; 1451 1454 1452 return (rc);1455 return rc; 1453 1456 } 1454 1457 */ … … 1485 1488 cs_ftime(&er->tps); 1486 1489 } 1487 return (er); 1490 1491 return er; 1488 1492 } 1489 1493 … … 1619 1623 int i, j, m, rejected; 1620 1624 1621 //uchar orig_caid[sizeof(er->caid)];1625 // uchar orig_caid[sizeof(er->caid)]; 1622 1626 time_t now; 1623 1627 … … 1769 1773 void oscam_process_emm(EMM_PACKET * ep) 1770 1774 { 1771 int au; //, ephs;1775 int au; 1772 1776 1773 1777 au = client[cs_idx].au; … … 1791 1795 { 1792 1796 if (tpa->time > tpb->time) 1793 return (1);1797 return 1; 1794 1798 if (tpa->time < tpb->time) 1795 return (-1);1799 return -1; 1796 1800 if (tpa->millitm > tpb->millitm) 1797 return (1);1801 return 1; 1798 1802 if (tpa->millitm < tpb->millitm) 1799 return (-1);1800 return (0);1803 return -1; 1804 return 0; 1801 1805 } 1802 1806 … … 1901 1905 tv.tv_usec = (td % 1000) * 1000; 1902 1906 // log_normal("delay %d.%06d", tv.tv_sec, tv.tv_usec); 1903 return (&tv); 1907 1908 return &tv; 1904 1909 } 1905 1910 … … 1913 1918 oscam_exit(0); 1914 1919 if (!pfd) 1915 return (-1);1920 return -1; 1916 1921 cs_ftime(&tp); 1917 1922 tp.time += timeout; … … 1930 1935 continue; 1931 1936 else 1932 return (0);1937 return 0; 1933 1938 } 1934 1939 … … 1949 1954 if (ph[client[cs_idx].ctyp].watchdog) 1950 1955 alarm(cfg->cmaxidle + (cfg->ctimeout + 500) / 1000 + 1); 1951 return (rc); 1956 1957 return rc; 1952 1958 } 1953 1959 … … 1972 1978 int scad; /* length of address */ 1973 1979 1974 //intfd; /* socket descriptors */1980 // int fd; /* socket descriptors */ 1975 1981 int i, j, n; 1976 1982 int bg = 0;
Note:
See TracChangeset
for help on using the changeset viewer.