summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-27 16:18:41 -0200
committerRenato Botelho <renato@netgate.com>2016-01-27 16:18:41 -0200
commit6d77218901c68616c2f97486c813b9a78c48046a (patch)
treef6974ba3b91df6ca8da937254277c65eb3c9cae2 /lib
parenteb84e0723f3b4bc5e40024f66fe21c14b09e9ec4 (diff)
parentfbe44d1207452eedc6fc9c1f386a335c5bda0e20 (diff)
downloadFreeBSD-src-6d77218901c68616c2f97486c813b9a78c48046a.zip
FreeBSD-src-6d77218901c68616c2f97486c813b9a78c48046a.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/sctp_sys_calls.c16
-rw-r--r--lib/libc/stdio/fopen.312
-rw-r--r--lib/libc/stdlib/tdelete.c11
-rw-r--r--lib/libdpv/dpv.c6
-rw-r--r--lib/libdpv/dpv.h3
5 files changed, 37 insertions, 11 deletions
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index f07aa43..dcbcee7 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -700,14 +700,19 @@ sctp_sendx(int sd, const void *msg, size_t msg_len,
#ifdef SYS_sctp_generic_sendmsg
if (addrcnt == 1) {
socklen_t l;
+ ssize_t ret;
/*
* Quick way, we don't need to do a connectx so lets use the
* syscall directly.
*/
l = addrs->sa_len;
- return (syscall(SYS_sctp_generic_sendmsg, sd,
- msg, msg_len, addrs, l, sinfo, flags));
+ ret = syscall(SYS_sctp_generic_sendmsg, sd,
+ msg, msg_len, addrs, l, sinfo, flags);
+ if ((ret >= 0) && (sinfo != NULL)) {
+ sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs);
+ }
+ return (ret);
}
#endif
@@ -984,6 +989,7 @@ sctp_sendv(int sd,
struct sockaddr *addr;
struct sockaddr_in *addr_in;
struct sockaddr_in6 *addr_in6;
+ sctp_assoc_t *assoc_id;
if ((addrcnt < 0) ||
(iovcnt < 0) ||
@@ -1002,6 +1008,7 @@ sctp_sendv(int sd,
errno = ENOMEM;
return (-1);
}
+ assoc_id = NULL;
msg.msg_control = cmsgbuf;
msg.msg_controllen = 0;
cmsg = (struct cmsghdr *)cmsgbuf;
@@ -1025,6 +1032,7 @@ sctp_sendv(int sd,
memcpy(CMSG_DATA(cmsg), info, sizeof(struct sctp_sndinfo));
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_sndinfo));
cmsg = (struct cmsghdr *)((caddr_t)cmsg + CMSG_SPACE(sizeof(struct sctp_sndinfo)));
+ assoc_id = &(((struct sctp_sndinfo *)info)->snd_assoc_id);
break;
case SCTP_SENDV_PRINFO:
if ((info == NULL) || (infolen < sizeof(struct sctp_prinfo))) {
@@ -1066,6 +1074,7 @@ sctp_sendv(int sd,
memcpy(CMSG_DATA(cmsg), &spa_info->sendv_sndinfo, sizeof(struct sctp_sndinfo));
msg.msg_controllen += CMSG_SPACE(sizeof(struct sctp_sndinfo));
cmsg = (struct cmsghdr *)((caddr_t)cmsg + CMSG_SPACE(sizeof(struct sctp_sndinfo)));
+ assoc_id = &(spa_info->sendv_sndinfo.snd_assoc_id);
}
if (spa_info->sendv_flags & SCTP_SEND_PRINFO_VALID) {
cmsg->cmsg_level = IPPROTO_SCTP;
@@ -1164,6 +1173,9 @@ sctp_sendv(int sd,
msg.msg_flags = 0;
ret = sendmsg(sd, &msg, flags);
free(cmsgbuf);
+ if ((ret >= 0) && (addrs != NULL) && (assoc_id != NULL)) {
+ *assoc_id = sctp_getassocid(sd, addrs);
+ }
return (ret);
}
diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3
index b39cb5a..f25e6df 100644
--- a/lib/libc/stdio/fopen.3
+++ b/lib/libc/stdio/fopen.3
@@ -120,7 +120,9 @@ This is strictly for compatibility with
.St -isoC
and has effect only for
.Fn fmemopen
-; otherwise the ``b'' is ignored.
+; otherwise
+.Dq Li b
+is ignored.
.Pp
Any created files will have mode
.Do Dv S_IRUSR
@@ -230,7 +232,9 @@ allocates
.Fa size
bytes of memory. This buffer is automatically freed when the
stream is closed. Buffers can be opened in text-mode (default) or binary-mode
-(if ``b'' is present in the second or third position of the
+(if
+.Dq Li b
+is present in the second or third position of the
.Fa mode
argument). Buffers opened in text-mode make sure that writes are terminated with
a NULL byte, if the last write hasn't filled up the whole buffer. Buffers
@@ -343,5 +347,7 @@ The
function
conforms to
.St -p1003.1-2008 .
-The ``b'' mode does not conform to any standard
+The
+.Dq Li b
+mode does not conform to any standard
but is also supported by glibc.
diff --git a/lib/libc/stdlib/tdelete.c b/lib/libc/stdlib/tdelete.c
index bef187e..8a599e5 100644
--- a/lib/libc/stdlib/tdelete.c
+++ b/lib/libc/stdlib/tdelete.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
+/* $NetBSD: tdelete.c,v 1.8 2016/01/20 20:47:41 christos Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -14,7 +14,7 @@
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: tdelete.c,v 1.6 2012/06/25 22:32:45 abs Exp $");
+__RCSID("$NetBSD: tdelete.c,v 1.8 2016/01/20 20:47:41 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD$");
@@ -25,9 +25,9 @@ __FBSDID("$FreeBSD$");
/*
- * find a node with given key
+ * delete node with given key
*
- * vkey: key to be found
+ * vkey: key to be deleted
* vrootp: address of the root of the tree
* compar: function to carry out node comparisons
*/
@@ -65,8 +65,7 @@ tdelete(const void * __restrict vkey, void ** __restrict vrootp,
q->rlink = (*rootp)->rlink;
}
}
- if (p != *rootp)
- free(*rootp); /* D4: Free node */
+ free(*rootp); /* D4: Free node */
*rootp = q; /* link parent to new node */
return p;
}
diff --git a/lib/libdpv/dpv.c b/lib/libdpv/dpv.c
index 6a03922..d3506ca 100644
--- a/lib/libdpv/dpv.c
+++ b/lib/libdpv/dpv.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <dialog.h>
#include <err.h>
#include <limits.h>
+#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -482,6 +483,11 @@ dpv(struct dpv_config *config, struct dpv_file_node *file_list)
/* Reads: label_size pbar_size pprompt aprompt dpv_nfiles */
/* Inits: dheight and dwidth */
+ /* Default localeconv(3) settings for dialog(3) status */
+ setlocale(LC_NUMERIC,
+ getenv("LC_ALL") == NULL && getenv("LC_NUMERIC") == NULL ?
+ LC_NUMERIC_DEFAULT : "");
+
if (!debug) {
/* Internally create the initial `--gauge' prompt text */
dprompt_recreate(file_list, (struct dpv_file_node *)NULL, 0);
diff --git a/lib/libdpv/dpv.h b/lib/libdpv/dpv.h
index dbcd59b..03768a7 100644
--- a/lib/libdpv/dpv.h
+++ b/lib/libdpv/dpv.h
@@ -38,6 +38,9 @@
#define FALSE 0
#endif
+/* localeconv(3) */
+#define LC_NUMERIC_DEFAULT "en_US.ISO8859-1"
+
/* Data to process */
extern long long dpv_overall_read;
OpenPOWER on IntegriCloud