Skip to content

Commit

Permalink
Bug appneta#368 remove strndup function
Browse files Browse the repository at this point in the history
  • Loading branch information
fklassen committed May 2, 2017
1 parent 6842cc9 commit 7b61f96
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dnl $Id$
AC_PREREQ([2.69])

dnl Set version info here!
AC_INIT([tcpreplay],[4.2.4],
AC_INIT([tcpreplay],[4.2.5-beta1],
[https://github.com/appneta/tcpreplay/issues],
[tcpreplay],
[http://tcpreplay.sourceforge.net/])
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
05/01/2017 Version 4.2.5-beta1
- Warnings when building on old distributions (#368)
- Fix more Lintian detected spelling errors (#365)

04/26/2017 Version 4.2.4
Expand Down
11 changes: 0 additions & 11 deletions src/common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,6 @@ _our_safe_strdup(const char *str, const char *funcname, const int line, const ch

}

char *
_our_safe_strndup(const char *str, size_t n, const char *funcname, const int line, const char *file)
{
char *copy = strndup(str, n);
if (copy == NULL) {
fprintf(stderr, "ERROR in %s:%s() line %d: Unable to strndup() %zu bytes: %s\n", file, funcname, line, n, strerror(errno));
exit(-1);
}
return copy;
}

/**
* calls free and sets to NULL.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ void *_our_safe_realloc(void *ptr, size_t len, const char *, const int, const ch
#define safe_strdup(x) _our_safe_strdup(x, __FUNCTION__, __LINE__, __FILE__)
char *_our_safe_strdup(const char *str, const char *, const int, const char *);

#define safe_strndup(x, n) _our_safe_strndup((x), (n), __FUNCTION__, __LINE__, __FILE__)
char *_our_safe_strndup(const char *str, size_t n, const char *, const int, const char *);

#define safe_free(x) _our_safe_free(x, __FUNCTION__, __LINE__, __FILE__)
void _our_safe_free(void *ptr, const char *, const int, const char *);

Expand Down
2 changes: 1 addition & 1 deletion src/tcpedit/plugins/dlt_en10mb/en10mb.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ dlt_en10mb_cleanup(tcpeditdlt_t *ctx)
int
dlt_en10mb_parse_subsmac_entry(const char *raw, en10mb_sub_entry_t *entry)
{
char *candidate = safe_strndup(raw, SUBSMAC_ENTRY_LEN);
char *candidate = safe_strdup(raw);
int parse_result = dualmac2hex(candidate, entry->target, entry->rewrite, SUBSMAC_ENTRY_LEN);

free(candidate);
Expand Down

0 comments on commit 7b61f96

Please sign in to comment.