Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get warning "ignoring return value of 'write'..." when compiling v2.5.0. #856

Open
kfogel opened this issue Oct 11, 2024 · 0 comments
Open

Comments

@kfogel
Copy link

kfogel commented Oct 11, 2024

I built tag v2.5.0 today and got this warning:

prompt$ make
mkdir bin
cp scripts/keyd-application-mapper bin/
sed -e 's#@PREFIX@#/usr/local#' keyd.service.in > keyd.service
sed -e 's#@PREFIX@#/usr/local#' src/vkbd/usb-gadget.service.in > src/vkbd/usb-gadget.service
cc -DVERSION=\"v2.5.0\ \(f33dca8\)\" -I/usr/local/include -L/usr/local/lib -Wall -Wextra -Wno-unused -std=c11 -DSOCKET_PATH=\"/var/run/keyd.socket\" -DCONFIG_DIR=\"/etc/keyd\" -DDATA_DIR=\"/usr/local/share/keyd\" -D_FORTIFY_SOURCE=2 -D_DEFAULT_SOURCE -Werror=format-security  -O3  src/*.c src/vkbd/uinput.c -lpthread -o bin/keyd 
src/daemon.c: In function ‘add_listener’:
src/daemon.c:84:33: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   84 |                                 write(con, layer->type == LT_LAYOUT ? "/" : "+", 1);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/daemon.c:85:33: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   85 |                                 write(con, layer->name, strlen(layer->name));
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/daemon.c:86:33: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   86 |                                 write(con, "\n", 1);
      |                                 ^~~~~~~~~~~~~~~~~~~
prompt$ 

Most places in the code use xwrite(). Is there a reason to use write() in these three places in src/daemon.c? I'd be happy to submit a PR to switch them to xwrite() to make the build warning go away, if you want, but I thought I'd check here first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant