Hi tech@,
The following check can only know whether the file is ELF or not, can't
know whether it is shared object or executable. So I think the error
message should be more accurate.
Thanks!
Best Regards
Nan Xiao
Index: ldd.c
ement, little endian
Version: 1 (current)
OS/ABI:UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
..
Is there any special consideration for it? Thanks very much in advanc
Actually, it should be more efficient to remove bzero() function
and keep set NULL-terminate char.
Best Regards
Nan Xiao
Index: pctr.c
===
RCS file: /cvs/src/usr.bin/pctr/pctr.c,v
retrieving revision 1.22
diff -u -p -r1.22 pctr.c
Hi tech@
Remove unnecessary assignment. Thanks!
Best Regards
Nan Xiao
Index: pctr.c
===
RCS file: /cvs/src/usr.bin/pctr/pctr.c,v
retrieving revision 1.23
diff -u -p -r1.23 pctr.c
--- pctr.c 10 Sep 2017 11:30:43 - 1.23
Hi tech@,
FYI, thanks!
Best Regards
Nan Xiao
Index: ldd.c
===
RCS file: /cvs/src/libexec/ld.so/ldd/ldd.c,v
retrieving revision 1.21
diff -u -p -r1.21 ldd.c
--- ldd.c 2 Jul 2017 19:06:12 - 1.21
+++ ldd.c 27 Sep
Hi tech@,
I think the type of size variable should be more accurate to use size_t
instead of int.
Best Regards
Nan Xiao
Index: ldd.c
===
RCS file: /cvs/src/libexec/ld.so/ldd/ldd.c,v
retrieving revision 1.21
diff -u -p -r1.21 ldd.c
< cur.msg_bufs; i++, p++) {
.
}
My patch can skip the whole loop, and the "dmesg" program just prints
a newline:
if (!newl)
putchar('\n');
Best Regards
Nan Xiao
Index: dmesg.c
===
RCS file: /cvs
Hi Tom,
Updated, thanks!
Best Regards
Nan Xiao
Index: dmesg.c
===
RCS file: /cvs/src/sbin/dmesg/dmesg.c,v
retrieving revision 1.29
diff -u -p -r1.29 dmesg.c
--- dmesg.c 1 Sep 2017 07:31:45 - 1.29
+++ dmesg.c 4 Sep
be NULL.
Hope to check it, thanks!
Best Regards
Nan Xiao
Hi tech@,
I am not a nitpicker. Though all memory will be reclaimed after process
exits, I still think it's a good habit to release all memory in heap.
Best Regards
Nan Xiao
Index: dmesg.c
===
RCS file: /cvs/src/sbin/dmesg/dmesg.c
Hi tech@,
I think check the actual read ELF header file size is better than just
"<0", thanks!
Best Reagrds
Nan Xiao
Index: ldd.c
===
RCS file: /cvs/src/libexec/ld.so/ldd/ldd.c,v
retrieving revision 1.21
diff -u -p
Hi tech@,
Use BUFSIZE instead of hard-code in netcat.c, FYI. Thanks!
Best Regards
Nan Xiao
Index: netcat.c
===
RCS file: /cvs/src/usr.bin/nc/netcat.c,v
retrieving revision 1.187
diff -u -p -r1.187 netcat.c
--- netcat.c15 Jul
erning about the "link-layer header type" of loopback packet, is
it reasonable to use "0x6C" instead of "0x0C"?
Thanks very much in advance!
Best Regards
Nan Xiao
Actually, I think "plen = sizeof(buf);" may be better.
Best Regards
Nan Xiao
On Tue, Oct 24, 2017 at 8:52 PM, Alexander Bluhm
<alexander.bl...@gmx.net> wrote:
> On Tue, Oct 24, 2017 at 07:44:02PM +0800, Nan Xiao wrote:
>> Use BUFSIZE instead of hard-code
Ouch! I misunderstood the patch by @bluhm, please ignore my
previous mail! I am very sorry for disrupting!
Best Regards
Nan Xiao
On Tue, Oct 24, 2017 at 9:30 PM, Nan Xiao <xiaonan830...@gmail.com> wrote:
> Actually, I think "plen = sizeof(buf);" may be better.
> B
(cpu_old[i] = calloc(CPUSTATES, sizeof(int64_t))) == NULL ||
(cpu_diff[i] = calloc(CPUSTATES, sizeof(int64_t))) == NULL)
- return (-1);
+ err(2, NULL);
}
for (v = views_cpu; v->name != NULL; v++)
--
Best Regards
Nan Xiao
the packets.
.It Fl k Ar kvars
Specify one or more kernel variables to monitor; multiple variables must be
separated with commas.
--
Best Regards
Nan Xiao
)
+ return (NULL);
if (offset_day || offset_sec) {
if (!OPENSSL_gmtime_adj(, offset_day, offset_sec))
--
Best Regards
Nan Xiao
)
- errx(1, "strdup");
+ err(1, "strdup");
ptb->kvars = check_prepare_kvars(tmp);
free(tmp);
break;
--
Best Regards
Nan Xiao
Very sorry for forgetting to cc reply into tech@.
Forwarded Message
Subject: Re: [patch] Set TCP send buffer size only when tcpbench client
works in TCP mode
Date: Thu, 10 May 2018 17:56:25 +0800
From: Nan Xiao <n...@chinadtrace.org>
To: Alexander Bluhm <alexander.bl..
_MODE && ptb->Sflag) {
if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
>Sflag, sizeof(ptb->Sflag)) == -1)
warn("set TCP send buffer size");
--
Best Regards
Nan Xiao
();
/* XXX Is there a better way to do this ? */
tv.tv_sec = ptb->rflag / 1000;
tv.tv_usec = (ptb->rflag % 1000) * 1000;
--
Best Regards
Nan Xiao
ouble) sysload.ldavg[i]) / sysload.fscale;
--
Best Regards
Nan Xiao
*infoloadp++ = ((double) sysload.ldavg[i]) / sysload.fscale;
Thanks!
On 5/24/2018 7:54 PM, Jeremie Courreges-Anglas wrote:
> On Tue, May 22 2018, Nan Xiao <n...@chinadtrace.org> wrote:
>> Hi tech@,
>>
>> Below is the patch of resetting sysload if sysctl call failed
Hi Philip,
Thanks for your comments!
On 6/9/2018 12:35 PM, Philip Guenther wrote:
> On Thu, Jun 7, 2018 at 12:34 AM Nan Xiao <mailto:n...@chinadtrace.org>> wrote:
>
> I think maybe one snprintf is more efficient and concise. Sorry if I am
> wrong, thanks!
>
&g
) &&
(hp = gethostbyaddr((char *), sizeof(addr), AF_INET)))
{
if (domain[0] != '\0') {
p = hp->h_name;
On 6/15/2018 5:57 AM, Raf Czlonka wrote:
> On Thu, Jun 14, 2018 at 06:28:47AM BST, Nan Xiao wrot
];
--
Best Regards
Nan Xiao
Hi Gerhard,
Thanks for your reply!
Yes, if no "kvm_close(kd);", there will be resource (memory, file
descriptor) leak. So hope you can commit it, thanks!
On 5/30/2018 4:49 PM, Gerhard Roth wrote:
> On Wed, 30 May 2018 16:25:55 +0800 Nan Xiao wrote:
>> Hi tech@,
>>
>
)
+ sizeof(struct kinfo_proc), ) == NULL) {
+ kvm_close(kd);
return (-1);
+ }
*elm = ber_add_integer(*elm, val);
ber_set_header(*elm, BER_CLASS_APPLICATION, SNMP_T_GAUGE32);
--
Best Regards
Nan Xiao
if (!MFI.hasReturnProtector() || !MFI.hasReturnProtectorTempRegister())
return;
- unsigned CFIIndex;
MachineBasicBlock::instr_iterator MBBI = MBB.instr_begin();
DebugLoc MBBDL = MBB.findDebugLoc(MBBI);
const Function = MF.getFunction();
--
Best Regards
Nan Xiao
%s", tmpfilenam);
+ goto out;
+ }
if (write(fd, , sizeof(struct hints_header)) !=
sizeof(struct hints_header)) {
--
Best Regards
Nan Xiao
= xmalloc(len);
- strlcpy(str, s1, len);
- strlcat(str, s2, len);
- strlcat(str, s3, len);
+ snprintf(str, len, "%s%s%s", s1, s2, s3);
return (str);
}
--
Best Regards
Nan Xiao
(i = 0; i < nintr; i++) {
char name[128];
--
Best Regards
Nan Xiao(肖楠)
_mib, 2, , , NULL, 0) < 0)
+ return (-1);
lccpu = log((double) ccpu / sysload.fscale);
--
Best Regards
Nan Xiao
--
Best Regards
Nan Xiao
);
- free_out = 1;
}
tree = X509_STORE_CTX_get0_policy_tree(ctx);
explicit_policy = X509_STORE_CTX_get_explicit_policy(ctx);
--
Best Regards
Nan Xiao
n the peer certificate when
using TLS.
Illegal if not using TLS.
.It Fl F
Pass the first connected socket using
--
Best Regards
Nan Xiao
PARAM_set_flags(X509_STORE_get0_param(store),
X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
}
--
Best Regards
Nan Xiao
Ping tech@,
Could anyone spare a minute to check this patch? I think it is indeed a bug.
On 9/4/2018 1:01 PM, Nan Xiao wrote:
> Hi tech@,
>
> Before netcat program exits, it will check whether s is -1, and close
> socket if s is not -1:
>
> if (s != -1)
>
) || errno == EBADF)
Since we close stderr, why do we need additional check of stdout here?
Thanks in advacne!
On 9/9/2018 7:39 AM, Alexander Bluhm wrote:
> On Sat, Sep 08, 2018 at 08:47:28PM +0800, Nan Xiao wrote:
>> I don't think need "if (fd > STDERR_FILENO)" cause the fd
8 5:07 AM, Alexander Bluhm wrote:
> On Tue, Sep 04, 2018 at 01:01:38PM +0800, Nan Xiao wrote:
>> Before netcat program exits, it will check whether s is -1, and close
>> socket if s is not -1:
>>
>> if (s != -1)
>> close(s);
>>
>> The follo
close(connfd);
>> }
>> -if (family != AF_UNIX)
>> -close(s);
>> -else if (uflag) {
>> +if (family == AF_UNIX && uflag) {
>> if (connect(s, NULL, 0) < 0)
>> err(1, "connect");
>> }
>
> otherwise OK bluhm@
>
--
Best Regards
Nan Xiao(肖楠)
struct sock
* address. Returns -1 on failure.
*/
int
-local_listen(char *host, char *port, struct addrinfo hints)
+local_listen(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
int s = -1, ret, x = 1, save_errno;
--
Best Regards
Nan Xiao
exander Bluhm wrote:
> On Sat, Sep 08, 2018 at 11:05:15AM +0800, Nan Xiao wrote:
>> The following patch fixes file descriptor leak in `dofile' function.
>> Sorry if I am wrong, thanks!
>
> It is a leak.
>
>> @@ -125,6 +125,7 @@ dupit:
>> (void)l
nding output to %s\n", p);
}
--
Best Regards
Nan Xiao
static size_t bsize;
static char *buf = NULL;
struct stat sbuf;
- wfd = fileno(stdout);
if (buf == NULL) {
+ wfd = fileno(stdout);
if (fstat(wfd, ))
err(1, "stdout");
bsize = MAXIMUM(sbuf.st_blksize,
/* LONG: involuntary ". */
+ u_int64_t p_uru_nivcsw; /* LONG: involuntary. */
u_int32_t p_uctime_sec; /* STRUCT TIMEVAL: child u+s time. */
u_int32_t p_uctime_usec;/* STRUCT TIMEVAL: child u+s time. */
--
Best Regards
Nan Xiao
err(1, "clock_gettime");
if (WIFSIGNALED(status))
exitonsig = WTERMSIG(status);
if (!WIFEXITED(status))
--
Best Regards
Nan Xiao
Hi Theo,
I am very sorry for this wrong modification!
Thanks!
Best Regards
Nan Xiao
On Fri, Apr 20, 2018 at 4:57 PM, Theo Buehler <t...@openbsd.org> wrote:
> I don't think these are "redundant quotes" but rather ditto marks:
>
> https://en.wikipedia.org/wiki/Ditto_mar
nd the above words from manual
(https://man.openbsd.org/clock_gettime.2).
Anyway, thanks for pointing it out!
On 4/20/2018 8:00 PM, Ingo Schwarze wrote:
> Hi,
>
> Nan Xiao wrote on Fri, Apr 20, 2018 at 05:28:01PM +0800:
>
>> FYI, thanks!
>
> No. Read the manual page and
Ping tech@,
Any developer can comment on this patch? I think it is indeed a bug.
Thanks!
On 9/30/2018 11:55 AM, Nan Xiao wrote:
> Hi tech@,
>
> The following patch fixed the resource leak when netcat works as a TLS
> server. Sorry if I am wrong, thanks!
>
>
Hi bluhm,
Thanks very much for your reply!
Yes, your patch covers all the corner cases, thanks!
On 10/2/2018 8:38 AM, Alexander Bluhm wrote:
> On Sun, Sep 30, 2018 at 11:55:58AM +0800, Nan Xiao wrote:
>> The following patch fixed the resource leak when netcat works as a TLS
>>
) {
+ tls_free(tls_ctx);
+ tls_ctx = NULL;
+ }
} else if (family == AF_UNIX) {
ret = 0;
--
Best Regards
Nan Xiao
int s = -1, ret, x = 1, save_errno;
int error;
- /* Allow nodename to be null. */
+ /* Allow hostname to be null. */
hints.ai_flags |= AI_PASSIVE;
/*
--
Best Regards
Nan Xiao
= -1;
+ } else if (uflag) {
if (connect(s, NULL, 0) < 0)
err(1, "connect");
}
Thanks!
--
Best Regards
Nan Xiao
ping tech@,
Very sorry for interrupting again! Anyone can give comment on this
issue? Thanks!
On 9/18/2018 6:37 PM, Nan Xiao wrote:
> Hi tech@,
>
> Assume I use netcat with UNIX-domain socket, and there is no
> temp_socket. Launch the server:
>
> # ./nc -U -l temp_socket
>
*last_tos = inner_ip->ip_tos;
}
They indeed don't handle IPv6. But for netcat, it actually hangle IPv6
case at leaet from code in preceding mail. If netcat doesn't want to
handle IPv6 intentionally, I think the IPv6 code should be removed,
thanks!
Best Regards
Nan Xiao
On Thu, Sep 20, 2018 at 7:45
ping tech@,
Any developer can comment on this patch? Thanks!
On 9/25/2018 10:10 PM, Nan Xiao wrote:
> Hi tech@,
>
> I am reading write(2) manual, and come across the following example:
>
> for (off = 0; off < bsz; off += nw)
> if ((nw = write(d, buf + off, bsz - o
-269,7 +269,7 @@ for further details).
Specifying TLS options requires
.Fl c .
.Pp
-For the IPv4 TOS value,
+For the IPv4 TOS/IPv6 Traffic Class value,
.Ar keyword
may be one of
.Cm critical ,
Thanks!
--
Best Regards
Nan Xiao
wrong, thanks very
much in advance!
On 9/26/2018 10:33 PM, Ingo Schwarze wrote:
> Hi,
>
> Nan Xiao wrote on Wed, Sep 26, 2018 at 09:42:02PM +0800:
>
>> Any developer can comment on this patch? Thanks!
>
> I think this change is a bad idea and should not be committed
Regards
Nan Xiao
On Tue, Sep 25, 2018 at 2:37 PM Jason McIntyre wrote:
>
> On Tue, Sep 25, 2018 at 09:11:42AM +0800, Nan Xiao wrote:
> > Hi tech@,
> >
>
> morning.
>
> > According to netcat source code, the `-T' option not only takes effect
> > in IPv4 but a
-164,7 +164,7 @@ ssize_t nw;
int d;
for (off = 0; off < bsz; off += nw)
- if ((nw = write(d, buf + off, bsz - off)) == 0 || nw == -1)
+ if ((nw = write(d, buf + off, bsz - off)) == -1)
err(1, "write");
.Ed
.Sh ERRORS
Thanks!
--
Best Regards
Nan Xiao
fd, i, status, interp=0;
+ size_t size;
char buf[PATH_MAX];
struct stat st;
void * dlhandle;
--
Best Regards
Nan Xiao
represented by the specified
.Ar who
and
--
Best Regards
Nan Xiao
DOUT_FILENO) == -1)
err(EXIT_MISC, NULL);
+ if (fd > STDERR_FILENO)
+ (void)close(fd);
(void)fprintf(stderr, "sending output to %s\n", p);
}
On 9/12/2018 8:17 PM, Alexander Bluhm wrote:
> On Sun, Sep 09, 2018 at 11:13:40AM +0800, Nan
Hi Philip,
Very sorry for my fault! Thanks very much for your time and explanation!
On 9/14/2018 1:28 PM, Philip Guenther wrote:
> On Thu, Sep 13, 2018 at 8:17 PM Nan Xiao <mailto:n...@chinadtrace.org>> wrote:
>
> The following patch fixes an error in chmod.1, and
}
So I think maybe the netcat manual should be enriched at least for `-T'
option, thanks!
--
Best Regards
Nan Xiao
(char *path)
if ((s = unix_bind(path, 0)) < 0)
return -1;
- if (listen(s, 5) < 0) {
+ if (listen(s, 1) < 0) {
close(s);
return -1;
}
--
Best Regards
Nan Xiao
)
return -1;
}
+ if (lflag)
+ unlink(path);
+
if (bind(s, (struct sockaddr *)_un, sizeof(s_un)) < 0) {
save_errno = errno;
close(s);
--
Best Regards
Nan Xiao
69 matches
Mail list logo