Coder Social home page Coder Social logo

Comments (1)

Luap99 avatar Luap99 commented on June 18, 2024

strace output with /dev/null on stdin

accept(3, {sa_family=AF_INET, sin_port=htons(44148), sin_addr=inet_addr("127.0.0.1")}, [128 => 16]) = 4
close(3)                                = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
pselect6(5, [0 4], [], NULL, NULL, NULL) = 2 (in [0 4])
read(0, "", 8192)                       = 0
exit_group(0)                           = ?
+++ exited with 0 +++

with /dev/zero on stdin:

...
accept(3, {sa_family=AF_INET, sin_port=htons(54661), sin_addr=inet_addr("127.0.0.1")}, [128 => 16]) = 4
close(3)                                = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
pselect6(5, [0 4], [], NULL, NULL, NULL) = 2 (in [0 4])
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192) = 8192
fcntl(4, F_GETFL)                       = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(4, F_SETFL, O_RDWR)               = 0
sendto(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192, 0, NULL, 0) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=74438, si_uid=1000} ---
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
close(4)                                = 0
read(0, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 8192) = 8192
exit_group(0)             

and when it is attached to the terminal (working):

accept(3, {sa_family=AF_INET, sin_port=htons(32795), sin_addr=inet_addr("127.0.0.1")}, [128 => 16]) = 4
close(3)                                = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
pselect6(5, [0 4], [], NULL, NULL, NULL) = 1 (in [4])
recvfrom(4, "test\n", 8192, 0, NULL, NULL) = 5
write(1, "test\n", 5test
)                   = 5
pselect6(5, [0 4], [], NULL, NULL, NULL) = 1 (in [4])
recvfrom(4, "", 8192, 0, NULL, NULL)    = 0
close(4)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

So if there is data on stdin (or it was closed) it will exit right away before printing the data it got.

from nmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.