Re: Baby X is bor nagain

Liste des GroupesRevenir à cl c  
Sujet : Re: Baby X is bor nagain
De : kalevi (at) *nospam* kolttonen.fi (Kalevi Kolttonen)
Groupes : comp.lang.c
Date : 11. Jun 2024, 19:21:03
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v4a4if$161mj$1@dont-email.me>
References : 1
User-Agent : tin/2.6.3-20231224 ("Banff") (Linux/6.8.11-300.fc40.x86_64 (x86_64))
Malcolm McLean <malcolm.arthur.mclean@gmail.com> wrote:
Can friendly people plesse dowload it and see if it compiles on other
platforms?

Fully up-to-date Fedora 40 with the following GCC:

kalevi@lappari ~$ rpm -qi gcc|head -4
Name        : gcc
Version     : 14.1.1
Release     : 4.fc40
Architecture: x86_64

The build fails:

[ 85%] Building C object CMakeFiles/babyxfs_shell.dir/babyxfs_src/shell/bbx_fs_shell.c.o
/home/kalevi/tmp/babyx/babyxrc/babyxfs_src/shell/bbx_fs_shell.c: In function ‘cp’:
/home/kalevi/tmp/babyx/babyxrc/babyxfs_src/shell/bbx_fs_shell.c:503:9: error: ‘return’ with no value, in function returning non-void [-Wreturn-mismatch]
  503 |         return;
      |         ^~~~~~
/home/kalevi/tmp/babyx/babyxrc/babyxfs_src/shell/bbx_fs_shell.c:481:12: note: declared here
  481 | static int cp(BBX_FS_SHELL *shell, int argc, char **argv)
      |            ^~
/home/kalevi/tmp/babyx/babyxrc/babyxfs_src/shell/bbx_fs_shell.c: In function ‘bbx_fs_system’:
/home/kalevi/tmp/babyx/babyxrc/babyxfs_src/shell/bbx_fs_shell.c:656:9: warning: ‘strncat’ specified bound 1024 equals destination size [-Wstringop-overflow=]
  656 |         strncat(line, " ", 1024);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/babyxfs_shell.dir/build.make:160: CMakeFiles/babyxfs_shell.dir/babyxfs_src/shell/bbx_fs_shell.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:341: CMakeFiles/babyxfs_shell.dir/all] Error 2
make: *** [Makefile:91: all] Error 2


After fixing the line 503 to be "return 0;", the build completed
and produced the executables.

But you should also address the -Wstringop-overflow warning.

I also got a warning about tmpnam() being dangerous and
a suggestion to use mkstemp() instead.

br,
KK

Date Sujet#  Auteur
11 Jun 24 o Re: Baby X is bor nagain1Kalevi Kolttonen

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal