Skip to content

Conversation

@andreasbaumann
Copy link
Contributor

The warning I got on gcc 15.1.1 (Arch) was:

check_apt.c: In function ‘run_upgrade’:
check_apt.c:319:50: warning: passing argument 1 of ‘cmd_file_read’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  319 |                 result.errorcode = cmd_file_read(input_filename, &chld_out, 0);
      |                                                  ^~~~~~~~~~~~~~
In file included from runcmd.h:28,
                 from check_apt.c:38:
../lib/utils_cmd.h:23:19: note: expected ‘char *’ but argument is of type ‘const char *’
   23 | int cmd_file_read(char *, output *, int);
      |                   ^~~~~~

The man page of glibc states than int open(const char *path, int oflag, ...); is the
prottype. cmd_file_read uses open here if ((fd = open(filename, O_RDONLY)) == -1)

@waja waja added this to the 2.4.1 milestone May 9, 2025
Copy link
Member

@RincewindsHat RincewindsHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thank you :-)

@RincewindsHat RincewindsHat merged commit b13f977 into master May 9, 2025
12 checks passed
@andreasbaumann andreasbaumann deleted the fix_check_apt_const_char branch May 10, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants