Hallo Aschref,

könntest du bitte die Reviews auf der RTEMS Mailinglist vorrangig behandeln. Wenn man einen Patch an die Mailingliste schickt, dann sollte man das auch durchziehen.

Der Betreff im Commit sollte den Bereich der Änderung möglichst genau als Stichwort enthalten. Es gibt viele psxtests aber nur einen psxndbm01. Das ist sehr wichtig zum Suchen in der Mailbox.

On 17/08/2020 11:57, Sebastian Huber wrote:
On 13/08/2020 17:58, Aschref Ben-Thabet wrote:

From: Aschref Ben Thabet<[email protected]>

replace strncpy with strdup to silence this warning since it tries to
allocate enough memory to hold the old string (plus a '\0' character
to mark the end of the string).

Could you please check if the use of the sizeof here makes sense:

  puts( "Fetch non-existing record and confirm error." );
  test_strings = strdup( "Hello" );

/* The data pointed by test_string is now pointed by key.dptr */
  key.dptr = test_strings;
  key.dsize = sizeof( test_strings );
  get_phone_no = dbm_fetch( db, key );
  rtems_test_assert( get_phone_no.dptr == NULL );
  dbm_close( db );

/* We need the 'key' object, hence we cannot free 'test_strings' */

/* dbm_delete() */

  puts( "\nTestcases for 'dbm_delete()'" );
  db = dbm_open( DB_NAME, O_RDWR, S_IRWXU );
  rtems_test_assert( db != NULL );

  puts( "Delete non-existing record and confirm error." );
  rtems_test_assert( dbm_delete( db, key ) != 0 );
  free( test_strings );
  rtems_test_assert( count_no_of_records( db ) == 2);

Why do we have to allocate the string? Can't we simply use a string constant?

_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to