Skip to content

Instantly share code, notes, and snippets.

@rkaneko
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkaneko/cae4a16e4492fbde4826 to your computer and use it in GitHub Desktop.
Save rkaneko/cae4a16e4492fbde4826 to your computer and use it in GitHub Desktop.
だめなやつ
// TODO refactor ここが原因で落ちる
std::string Handler::receive(const int &client_sd) {
char buf[RCV_BUF_SIZE];
// readで落ちる?
if (read(client_sd, buf, RCV_BUF_SIZE) < 0) {
Logger::error() << "read()";
}
std::string str(buf);
return str;
}
@rkaneko
Copy link
Author

rkaneko commented Jul 14, 2014

readの戻り値をきちんと判定しなければならないかも。
http://www.kt.rim.or.jp/~ksk/sock-faq/unix-socket-faq-ja-2.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment