BUILD/MINOR: systemd: fix compiler warning about unused result

There is a compiler warning after commit 1b6e75fa84 ("MEDIUM: haproxy-
systemd-wrapper: Use haproxy in same directory"):

src/haproxy-systemd-wrapper.c: In function ‘locate_haproxy’:
src/haproxy-systemd-wrapper.c:28:10: warning: ignoring return value of ‘readlink’, declared with attribute warn_unused_result [-Wunused-result]

Fix the compiler warning by checking the return value of readlink().
This commit is contained in:
Lukas Tribus 2013-12-10 08:32:56 +01:00 committed by Willy Tarreau
parent 6bbb2f68cd
commit 439cfde55b

View File

@ -24,8 +24,8 @@ static char **main_argv;
static void locate_haproxy(char *buffer, size_t buffer_size) static void locate_haproxy(char *buffer, size_t buffer_size)
{ {
char* end; char* end = NULL;
readlink("/proc/self/exe", buffer, buffer_size); if (readlink("/proc/self/exe", buffer, buffer_size) > 0)
end = strrchr(buffer, '/'); end = strrchr(buffer, '/');
if (end == NULL) if (end == NULL)
strncpy(buffer, "/usr/sbin/haproxy", buffer_size); strncpy(buffer, "/usr/sbin/haproxy", buffer_size);