Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main/sd_notify.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
#pragma once

// Implement the systemd notify protocol without external dependencies.
int sd_notifyf(int unset_environment, const char *format, ...);
int sd_notifyf(int unset_environment, const char *format, ...)
__attribute__((format(printf, 2, 3), weak));
Comment on lines +7 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if sd_notifyf definition has weak attribute

# Search for the function definition and surrounding context
rg -n -A 5 -B 2 'sd_notifyf.*\{' main/sd_notify.c

Repository: DPDK/grout

Length of output: 305


Apply weak to the sd_notifyf definition (not just the header declaration)
main/sd_notify.h marks the sd_notifyf declaration as __attribute__((format(printf, 2, 3), weak)), but main/sd_notify.c defines sd_notifyf without the weak attribute (function definition starts at int sd_notifyf(...) {). To allow libsystemd’s sd_notifyf to override and prevent multiple-definition link errors, the weak attribute needs to be on the definition (or an equivalent weak symbol/alias must be created there).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@main/sd_notify.h` around lines 7 - 8, The sd_notifyf declaration is marked
weak in the header but the implementation of sd_notifyf (the function
definition) is not, causing possible multiple-definition/link conflicts; update
the sd_notifyf definition to include the weak attribute (same as the header:
__attribute__((format(printf, 2, 3), weak))) or add an equivalent weak alias for
sd_notifyf in the implementation so libsystemd can override it, ensuring the
symbol is weak at the definition site (target the sd_notifyf function
definition/implementation).

Loading