- count = read(fd, r_buf, 1);
-
- if (count < 0) {
- DBG("read failed");
- close(fd);
- return -1;
- } else {
- DBG("read size = %d", count);
- }
-
- if (r_buf[0] == 'e') {
- close(fd);
- continue;
- } else {
- DBG("e is already written");
- }
-
- if (lseek(fd, 0, SEEK_SET) < 0) {
- DBG("lseek failed");
- close(fd);
- return -1;
- }
-
- count = write(fd, "e", 1);
-
- if (count < 0) {
- DBG("write failed");
- close(fd);
- return -1;
- } else {
- DBG("write size = %d", count);
- }