s3:smb2_setinfo: fix memory leak in the defer_rename case
[Samba.git] / lib / replace / inet_ntoa.c
blobe3b80ebef8b923f0f2fbe0639cb77bf012ceaa48
1 /*
2 * Unix SMB/CIFS implementation.
3 * replacement routines for broken systems
4 * Copyright (C) Andrew Tridgell 2003
5 * Copyright (C) Michael Adam 2008
7 * ** NOTE! The following LGPL license applies to the replace
8 * ** library. This does NOT imply that all of Samba is released
9 * ** under the LGPL
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 3 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 #include "replace.h"
26 #include "system/network.h"
28 /**
29 * NOTE: this is not thread safe, but it can't be, either
30 * since it returns a pointer to static memory.
32 char *rep_inet_ntoa(struct in_addr ip)
34 uint8_t *p = (uint8_t *)&ip.s_addr;
35 static char buf[18];
36 slprintf(buf, 17, "%d.%d.%d.%d",
37 (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
38 return buf;