mirror of
https://github.com/wiiu-env/ftpiiu.git
synced 2024-11-22 01:39:18 +01:00
- fix errno function, used wrong one
- bump version to 0.4
This commit is contained in:
parent
4f6a1a8e58
commit
e09e81afe6
@ -2,8 +2,8 @@
|
|||||||
<app version="1">
|
<app version="1">
|
||||||
<name>FTPiiU</name>
|
<name>FTPiiU</name>
|
||||||
<coder>joedj</coder>
|
<coder>joedj</coder>
|
||||||
<version>0.3</version>
|
<version>0.4</version>
|
||||||
<release_date>20160331200000</release_date>
|
<release_date>20161101200000</release_date>
|
||||||
<short_description>An FTP server</short_description>
|
<short_description>An FTP server</short_description>
|
||||||
<long_description>ftpiiU is an FTP server for WiiU.
|
<long_description>ftpiiU is an FTP server for WiiU.
|
||||||
|
|
||||||
|
@ -39,8 +39,7 @@ EXPORT_DECL(int, sendto, int s, const void *buffer, int size, int flags, const s
|
|||||||
EXPORT_DECL(int, setsockopt, int s, int level, int optname, void *optval, int optlen);
|
EXPORT_DECL(int, setsockopt, int s, int level, int optname, void *optval, int optlen);
|
||||||
EXPORT_DECL(char *, inet_ntoa, struct in_addr in);
|
EXPORT_DECL(char *, inet_ntoa, struct in_addr in);
|
||||||
EXPORT_DECL(int, inet_aton, const char *cp, struct in_addr *inp);
|
EXPORT_DECL(int, inet_aton, const char *cp, struct in_addr *inp);
|
||||||
EXPORT_DECL(int*, get_h_errno, void);
|
EXPORT_DECL(int, socketlasterr, void);
|
||||||
EXPORT_DECL(const char*, gai_strerror, int);
|
|
||||||
|
|
||||||
void InitSocketFunctionPointers(void)
|
void InitSocketFunctionPointers(void)
|
||||||
{
|
{
|
||||||
@ -72,8 +71,7 @@ void InitSocketFunctionPointers(void)
|
|||||||
OS_FIND_EXPORT(nsysnet_handle, setsockopt);
|
OS_FIND_EXPORT(nsysnet_handle, setsockopt);
|
||||||
OS_FIND_EXPORT(nsysnet_handle, inet_ntoa);
|
OS_FIND_EXPORT(nsysnet_handle, inet_ntoa);
|
||||||
OS_FIND_EXPORT(nsysnet_handle, inet_aton);
|
OS_FIND_EXPORT(nsysnet_handle, inet_aton);
|
||||||
OS_FIND_EXPORT(nsysnet_handle, get_h_errno);
|
OS_FIND_EXPORT(nsysnet_handle, socketlasterr);
|
||||||
OS_FIND_EXPORT(nsysnet_handle, gai_strerror);
|
|
||||||
|
|
||||||
unsigned int nn_startupid;
|
unsigned int nn_startupid;
|
||||||
ACInitialize();
|
ACInitialize();
|
||||||
|
@ -97,10 +97,9 @@ extern int (*setsockopt)(int s, int level, int optname, void *optval, int optlen
|
|||||||
extern char * (*inet_ntoa)(struct in_addr in);
|
extern char * (*inet_ntoa)(struct in_addr in);
|
||||||
extern int (*inet_aton)(const char *cp, struct in_addr *inp);
|
extern int (*inet_aton)(const char *cp, struct in_addr *inp);
|
||||||
|
|
||||||
extern int *(*get_h_errno)(void);
|
extern int (*socketlasterr)(void);
|
||||||
extern const char *(*gai_strerror)(int errno); // huh, gai o.O
|
|
||||||
|
|
||||||
#define geterrno() (*(get_h_errno()))
|
#define geterrno() (socketlasterr())
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ int Menu_Main(void)
|
|||||||
OSScreenFlipBuffersEx(0);
|
OSScreenFlipBuffersEx(0);
|
||||||
OSScreenFlipBuffersEx(1);
|
OSScreenFlipBuffersEx(1);
|
||||||
|
|
||||||
console_printf("FTPiiU v0.3 is listening on %u.%u.%u.%u:%i", (network_gethostip() >> 24) & 0xFF, (network_gethostip() >> 16) & 0xFF, (network_gethostip() >> 8) & 0xFF, (network_gethostip() >> 0) & 0xFF, PORT);
|
console_printf("FTPiiU v0.4 is listening on %u.%u.%u.%u:%i", (network_gethostip() >> 24) & 0xFF, (network_gethostip() >> 16) & 0xFF, (network_gethostip() >> 8) & 0xFF, (network_gethostip() >> 0) & 0xFF, PORT);
|
||||||
|
|
||||||
MountVirtualDevices();
|
MountVirtualDevices();
|
||||||
|
|
||||||
|
21
src/net.c
21
src/net.c
@ -71,7 +71,8 @@ s32 network_socket(u32 domain,u32 type,u32 protocol)
|
|||||||
int sock = socket(domain, type, protocol);
|
int sock = socket(domain, type, protocol);
|
||||||
if(sock < 0)
|
if(sock < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : sock;
|
||||||
}
|
}
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
@ -81,7 +82,8 @@ s32 network_bind(s32 s,struct sockaddr *name,s32 namelen)
|
|||||||
int res = bind(s, name, namelen);
|
int res = bind(s, name, namelen);
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -91,7 +93,8 @@ s32 network_listen(s32 s,u32 backlog)
|
|||||||
int res = listen(s, backlog);
|
int res = listen(s, backlog);
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -101,7 +104,8 @@ s32 network_accept(s32 s,struct sockaddr *addr,s32 *addrlen)
|
|||||||
int res = accept(s, addr, addrlen);
|
int res = accept(s, addr, addrlen);
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -111,7 +115,8 @@ s32 network_connect(s32 s,struct sockaddr *addr, s32 addrlen)
|
|||||||
int res = connect(s, addr, addrlen);
|
int res = connect(s, addr, addrlen);
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -121,7 +126,8 @@ s32 network_read(s32 s,void *mem,s32 len)
|
|||||||
int res = recv(s, mem, len, 0);
|
int res = recv(s, mem, len, 0);
|
||||||
if(res < 0)
|
if(res < 0)
|
||||||
{
|
{
|
||||||
return -geterrno();
|
int err = -geterrno();
|
||||||
|
return (err < 0) ? err : res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -140,7 +146,8 @@ s32 network_write(s32 s, const void *mem,s32 len)
|
|||||||
int ret = send(s, mem, len, 0);
|
int ret = send(s, mem, len, 0);
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
{
|
{
|
||||||
transfered = -geterrno();
|
int err = -geterrno();
|
||||||
|
transfered = (err < 0) ? err : ret;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user