Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fred Fish <fnf@intrinsity.com>
To: gdb-patches@sources.redhat.com
Cc: fnf@intrinsity.com
Subject: [RFA] Fix gdb.gdbtk/simple.c strncpy args
Date: Sat, 07 Sep 2002 18:56:00 -0000	[thread overview]
Message-ID: <200209080156.g881u5w10758@beeville.vert.intrinsity.com> (raw)

Strncpy is supposed to take pointers...

  simple.c: In function `main':
  simple.c:15: warning: passing arg 1 of `strncpy' makes pointer from integer without a cast
  simple.c:15: warning: passing arg 2 of `strncpy' makes pointer from integer without a cast
  WARNING: Testcase compile failed, so some tests in this file will automatically fail.

2002-09-07  Fred Fish  <fnf@intrinsity.com>

	* simple.c:  Pass addresses to strncpy, not chars.

Index: simple.c
===================================================================
RCS file: /mips/newtools/fsf/gdb/gdb/testsuite/gdb.gdbtk/simple.c,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 simple.c
*** simple.c	2002/07/04 20:33:37	1.1.1.1
--- simple.c	2002/09/08 01:23:50
*************** main(int argc, char * argv[])
*** 12,18 ****
       {
         int j = i % 3;
         int k = 3 - j;
!        strncpy (a[i], b[k], j);
         foo = (long) j * k / i + 2 * k * k * k;
       }
     return 0;
--- 12,18 ----
       {
         int j = i % 3;
         int k = 3 - j;
!        strncpy (&a[i], &b[k], j);
         foo = (long) j * k / i + 2 * k * k * k;
       }
     return 0;


             reply	other threads:[~2002-09-08  1:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-07 18:56 Fred Fish [this message]
2002-09-09  8:39 ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200209080156.g881u5w10758@beeville.vert.intrinsity.com \
    --to=fnf@intrinsity.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox