Project

General

Profile

Bug #10309

mkstr: NULL pointer errors

Added by Toomas Soome about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2019-01-27
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

NULL pointer errors:

    In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdio_iso.h:53:0,
                     from /code/illumos-gate/proto/root_i386/usr/include/stdio.h:82,
                     from mkstr.c:56:
    mkstr.c: In function 'copystr':
    /code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: passing argument 3 of 'hashit' makes integer from pointer without a cast [-Werror=int-conversion]
     #define NULL ((void *)0)
                  ^
    mkstr.c:240:37: note: in expansion of macro 'NULL'
      (void) printf("%d", hashit(buf, 1, NULL));
                                         ^~~~
    mkstr.c:75:12: note: expected 'unsigned int' but argument is of type 'void *'
     static int hashit(char *str, char really, unsigned int fakept);
                ^~~~~~
    mkstr.c: In function 'inithash':
    mkstr.c:257:46: error: comparison between pointer and integer [-Werror]
      while (fgetNUL(buf, sizeof (buf), mesgread) != NULL) {
                                                  ^~
    mkstr.c: In function 'fgetNUL':
    mkstr.c:318:46: error: pointer/integer type mismatch in conditional expression [-Werror]
      return ((feof(file) || ferror(file)) ? NULL : 1);
                                                  ^
    mkstr.c:318:46: error: return makes integer from pointer without a cast [-Werror=int-conversion]
      return ((feof(file) || ferror(file)) ? NULL : 1);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
    cc1: all warnings being treated as errors

History

#1

Updated by Electric Monk 12 months ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit 332e84f52cdee3d0232bd5ac5306c42177959c96

commit  332e84f52cdee3d0232bd5ac5306c42177959c96
Author: Toomas Soome <tsoome@me.com>
Date:   2019-02-04T18:39:11.000Z

    10309 mkstr: NULL pointer errors
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF