Menu

#4 recover.c should include sys/sysmacros.h for makedev()

open
nobody
None
2019-05-30
2016-04-19
No

the makedev() function is defined in sys/sysmacros.h, so recover.c should include it to avoid missing prototypes. otherwise you can get build failures like:

recover.c: In function ‘recover_file’:
recover.c:478:35: warning: implicit declaration of function ‘makedev’ [-Wimplicit-function-declaration]
    retval = mknod(helpname, type ,makedev(major, minor));
ext4magic-recover.o: In function `recover_file':
src/recover.c:478: undefined reference to `makedev'

Discussion

  • Robi

    Robi - 2016-04-20

    Unfortunately I can not reproduce the warning:
    warning: implicit declaration of function 'makedev'

    Can you tell me on which system/version this warning is reproducible.
    On all systems I've tested, sys/sysmacros.h automatically involved over <stdlib.h>

    stdlib.h #include <sys types.h="">
    sys/types.h #include <sys sysmacros.h="">

    Robi

     
  • Mike Frysinger

    Mike Frysinger - 2016-04-20

    the implicit includes of sys/sysmacros.h by other headers is being fixed in C libs like glibc. it's not been released yet. so the error i posted will happen in the future, so better to fix it now ;).

     
  • Robi

    Robi - 2016-04-20

    okay, I have found the cause.
    deprecated sys/sysmacros.h inclusion from sys/types.h

    We will modify this in recover.c

    thank you

    Robi

     
  • Olav Seyfarth

    Olav Seyfarth - 2019-05-30

    This seems to be easy to fix by adding
    #include <sys/sysmacros.h>
    in recover.c

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.