aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/netstat.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-01-01 16:59:35 -0600
committerRob Landley <rob@landley.net>2015-01-01 16:59:35 -0600
commit82effc97f9f2d1c258ea50cb11b130753b8ba805 (patch)
treef6c584d2b1675a91eb1a016977560ff7148c15a1 /toys/pending/netstat.c
parent5f53d130b1eae9041cc88c0ffb89e2b5823da393 (diff)
downloadtoybox-82effc97f9f2d1c258ea50cb11b130753b8ba805.tar.gz
Switch a lot of strncpy() calls to xstrncpy().
Diffstat (limited to 'toys/pending/netstat.c')
-rw-r--r--toys/pending/netstat.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/toys/pending/netstat.c b/toys/pending/netstat.c
index 59355638..fbb9eb12 100644
--- a/toys/pending/netstat.c
+++ b/toys/pending/netstat.c
@@ -76,15 +76,6 @@ static const char *get_basename(char *name)
if (c) return c + 1;
return name;
}
-/*
- * copy string from src to dest -> only number of bytes.
- */
-static char *safe_strncpy(char *dst, char *src, size_t size)
-{
- if(!size) return dst;
- dst[--size] = '\0';
- return strncpy(dst, src, size);
-}
/*
* locate character in string.
@@ -410,7 +401,7 @@ static void add2list(long inode, char *progname)
}
PID_LIST *new = (PID_LIST *)xzalloc(sizeof(PID_LIST));
new->inode = inode;
- safe_strncpy(new->name, progname, PROGNAME_LEN-1);
+ xstrncpy(new->name, progname, PROGNAME_LEN);
new->next = pid_list;
pid_list = new;
}