#include#include #include #include int main(void) { int fd; char filename[] = "/root/wenhao"; /* file is not exist */ if ((fd = open(filename, O_RDONLY)) == -1) { syslog(LOG_ERR | LOG_LOCAL0, "open %s: %m\n", filename); exit(1); } return 0; }
[root@localhost ex15_syslog]# tail -n 1 /var/log/messages
Sep 6 14:17:46 localhost syslog: open /root/wenhao: No such file or directory
转自: