cpuguy83 / containerd-shim-systemd-v1

Apache License 2.0
57 stars 2 forks source link

When I build the package ,I met a error message from pty.c #4

Closed sober-wang closed 1 year ago

sober-wang commented 2 years ago

How to fix this error message?

go build -o bin/ .
# github.com/cpuguy83/containerd-shim-systemd-v1
pty.c: 在函数‘handle_tty_op_conn’中:
pty.c:76:18: 警告:‘write’ reading 8 bytes from a region of size 4 [-Wstringop-overflow=]
   76 |             nw = write(fd, sizeof(msg)+msg, sizeof(msg));
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from pty.c:5:
/usr/include/unistd.h:378:16: 附注:in a call to function ‘write’ declared with attribute ‘read_only (2, 3)’
  378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~

Env

cpuguy83 commented 2 years ago

Hmm... I'm not sure why I am adding sizeof to what's being read. Probably can get rid of that.

cpuguy83 commented 1 year ago

This is fixed. Thanks!