[strongSwan-dev] [PATCH] substitute obsolete function calls (bzero/index)
Andreas Steffen
andreas.steffen at strongswan.org
Sun Aug 1 21:21:35 CEST 2010
Hi Waldemar,
applied to master:
http://git.strongswan.org/?p=strongswan.git;a=commitdiff;h=45e962edef6acac2b3501382e1528b164d3fbb89
Thanks
Andreas
On 07/31/2010 08:06 PM, Waldemar Brodkorb wrote:
> Hi Developers,
> The usage of bzero and index is obsolete, this patch
> updates the code to use memset and strchr.
> Useful for embedded linux users with uClibc toolchain.
>
> thanks in advance for comments or inclusion.
> Waldemar
>
> Signed-off-by: Waldemar Brodkorb <wbx at openadk.org>
> ---
> src/pluto/alg_info.c | 2 +-
> src/starter/interfaces.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/pluto/alg_info.c b/src/pluto/alg_info.c
> index 32fd46e..7b8ebc3 100644
> --- a/src/pluto/alg_info.c
> +++ b/src/pluto/alg_info.c
> @@ -414,7 +414,7 @@ struct alg_info_esp *alg_info_esp_create_from_str(char *alg_str)
> alg_info_esp = malloc_thing (struct alg_info_esp);
> zero(alg_info_esp);
>
> - pfs_name=index (alg_str, ';');
> + pfs_name=strchr (alg_str, ';');
> if (pfs_name)
> {
> memcpy(esp_buf, alg_str, pfs_name-alg_str);
> diff --git a/src/starter/interfaces.c b/src/starter/interfaces.c
> index 92b2c74..ef26cdc 100644
> --- a/src/starter/interfaces.c
> +++ b/src/starter/interfaces.c
> @@ -56,7 +56,7 @@ get_defaultroute(defaultroute_t *defaultroute)
> ssize_t msglen;
> int fd;
>
> - bzero(&rtu, sizeof(rtu));
> + memset(&rtu, 0, sizeof(rtu));
> rtu.m.nh.nlmsg_len = NLMSG_LENGTH(sizeof(rtu.m.rt));
> rtu.m.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
> rtu.m.nh.nlmsg_type = RTM_GETROUTE;
> @@ -142,7 +142,7 @@ get_defaultroute(defaultroute_t *defaultroute)
> plog("could not open AF_INET socket");
> break;
> }
> - bzero(&req, sizeof(req));
> + memset(&req, 0, sizeof(req));
> req.ifr_ifindex = iface_idx;
> if (ioctl(fd, SIOCGIFNAME, &req) < 0 ||
> ioctl(fd, SIOCGIFADDR, &req) < 0)
--
======================================================================
Andreas Steffen andreas.steffen at strongswan.org
strongSwan - the Linux VPN Solution! www.strongswan.org
Institute for Internet Technologies and Applications
University of Applied Sciences Rapperswil
CH-8640 Rapperswil (Switzerland)
===========================================================[ITA-HSR]==
More information about the Dev
mailing list