X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fldp.c;h=d0cf2b913670d1c810de0545df7e1b06b214c9e4;hb=541406241231c863deb59f794890e16e5ba6ea5a;hp=70a4299083ed613b15d8193b8e04dbc9044ecf8d;hpb=7b74b073e4e351fdc0ca1f94655c572405176a1b;p=vpp.git diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 70a4299083e..d0cf2b91367 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -109,7 +109,11 @@ typedef struct #define LDBG(_lvl, _fmt, _args...) \ if (ldp->debug > _lvl) \ - clib_warning ("ldp<%d>: " _fmt, getpid(), ##_args) + { \ + int errno_saved = errno; \ + clib_warning ("ldp<%d>: " _fmt, getpid(), ##_args); \ + errno = errno_saved; \ + } static ldp_main_t ldp_main = { .vlsh_bit_val = (1 << LDP_SID_BIT_MIN), @@ -132,11 +136,8 @@ ldp_worker_get_current (void) static inline void ldp_set_app_name (char *app_name) { - int rv = snprintf (ldp->app_name, LDP_APP_NAME_MAX, - "ldp-%d-%s", getpid (), app_name); - - if (rv >= LDP_APP_NAME_MAX) - app_name[LDP_APP_NAME_MAX - 1] = 0; + snprintf (ldp->app_name, LDP_APP_NAME_MAX, + "ldp-%d-%s", getpid (), app_name); } static inline char * @@ -485,8 +486,13 @@ writev (int fd, const struct iovec * iov, int iovcnt) return size; } +#ifdef HAVE_FCNTL64 +int +fcntl64 (int fd, int cmd, ...) +#else int fcntl (int fd, int cmd, ...) +#endif { vls_handle_t vlsh; int rv = 0; @@ -534,7 +540,11 @@ fcntl (int fd, int cmd, ...) } else { +#ifdef HAVE_FCNTL64 + rv = libc_vfcntl64 (fd, cmd, ap); +#else rv = libc_vfcntl (fd, cmd, ap); +#endif } va_end (ap); @@ -643,6 +653,7 @@ ldp_select_vcl_map_to_libc (clib_bitmap_t * vclb, fd_set * __restrict libcb) /* *INDENT-OFF* */ clib_bitmap_foreach (si, vclb, ({ vlsh = vls_session_index_to_vlsh (si); + ASSERT (vlsh != VLS_INVALID_HANDLE); fd = ldp_vlsh_to_fd (vlsh); if (PREDICT_FALSE (fd < 0)) {