Skip to content

Commit 57b2605

Browse files
authored
Merge pull request #165 from dang/push
Make a header for strl*()
2 parents fddcb84 + ec03704 commit 57b2605

File tree

7 files changed

+48
-9
lines changed

7 files changed

+48
-9
lines changed

src/clnt_perror.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#include <rpc/auth.h>
4747
#include <rpc/clnt.h>
4848

49+
#include "strl.h"
50+
4951
static char *auth_errmsg(enum auth_stat);
5052

5153
/*

src/netnamer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#include <stdlib.h>
4949
#include <unistd.h>
5050

51+
#include "strl.h"
52+
5153
static char *OPSYS = "unix";
5254
static char *NETID = "netid.byname";
5355
static char *NETIDFILE = "/etc/netid";

src/rpc_dplx_internal.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ struct rpc_dplx_rec {
8484
#define RPC_DPLX_LOCKED 0x00100000
8585
#define RPC_DPLX_UNLOCK 0x00200000
8686

87-
#ifndef HAVE_STRLCAT
88-
extern size_t strlcat(char *, const char *, size_t);
89-
#endif
90-
91-
#ifndef HAVE_STRLCPY
92-
extern size_t strlcpy(char *, const char *src, size_t);
93-
#endif
94-
9587
/* in clnt_generic.c */
9688
enum xprt_stat clnt_req_process_reply(SVCXPRT *, struct svc_req *);
9789
int clnt_req_xid_cmpf(const struct opr_rbtree_node *lhs,

src/rpc_generic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <assert.h>
6464

6565
#include "rpc_com.h"
66+
#include "strl.h"
6667

6768
void
6869
thr_keyfree(void *k)

src/rpcb_clnt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <assert.h>
5959

6060
#include "rpc_com.h"
61+
#include "strl.h"
6162

6263
/* retry timeout default to the moon and back */
6364
static struct timespec to = { 3, 0 };

src/strl.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2019 Red Hat, Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in the
12+
* documentation and/or other materials provided with the distribution.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
15+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17+
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#ifndef STRL_H
27+
#define STRL_H
28+
29+
#include "config.h"
30+
31+
#ifndef HAVE_STRLCAT
32+
extern size_t strlcat(char *, const char *, size_t);
33+
#endif
34+
35+
#ifndef HAVE_STRLCPY
36+
extern size_t strlcpy(char *, const char *src, size_t);
37+
#endif
38+
39+
40+
#endif /* STRL_H */

src/strlcpy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*/
1616

17-
#ifndef HAVE_STRLCPY
1817

1918
#include "config.h"
19+
#ifndef HAVE_STRLCPY
2020
#include <sys/types.h>
21+
#include "strl.h"
2122

2223
/*
2324
* Copy src to string dst of size siz. At most siz-1 characters

0 commit comments

Comments
 (0)