From e748f56a6bea5b17339d70b767311897769a7c97 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 25 Mar 2002 06:18:07 +0000 Subject: * ext/socket/socket.c (bsock_do_not_rev_lookup_set): should not be allowed when $SAFE > 3. * eval.c (rb_thread_ready): THREAD_TO_KILL threads should not turn into THREAD_RUNNABLE on wakeup. * eval.c (rb_thread_list): THREAD_TO_KILL threads should be in the list. * eval.c (thgroup_list): ditto; by moving gid clearance from rb_thread_cleanup(). * dir.c (fnmatch): "*/bar" (with FNM_PATHNAME flag) does not match "foo/bar". * io.c (read_all): files on /proc filesystem with zero stat size, may have contents. * ext/socket/socket.c (tcp_s_gethostbyname): refactored. * ext/socket/socket.c (sock_s_gethostbyname): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sprintf.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sprintf.c') diff --git a/sprintf.c b/sprintf.c index 2355a65f9c..c1e6b47f84 100644 --- a/sprintf.c +++ b/sprintf.c @@ -438,8 +438,13 @@ rb_f_sprintf(argc, argv) } s = nbuf; if (v < 0) { - strcpy(s, ".."); - s += 2; + if (base == 10) { + rb_warning("negative number for %%u specifier"); + } + else { + strcpy(s, ".."); + s += 2; + } } sprintf(fbuf, "%%l%c", *p); sprintf(s, fbuf, v); @@ -491,8 +496,13 @@ rb_f_sprintf(argc, argv) remove_sign_bits(++s, base); val = rb_str_new(0, 3+strlen(s)); t = RSTRING(val)->ptr; - strcpy(t, ".."); - t += 2; + if (base == 10) { + rb_warning("negative number for %%u specifier"); + } + else { + strcpy(t, ".."); + t += 2; + } switch (base) { case 16: if (s[0] != 'f') strcpy(t++, "f"); break; -- cgit v1.2.3