Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
int fd;
int flags;
char *editor;

if(!(fd = fopenopen(file_name, 0, O_RDONLY))) {
  /* Handle Error */
}

if((flags = fcntl(fd, F_GETFD, 0)) < 0) {
  /* Handle Error */
}

if(fcntl(fd, F_SET_FD, flags | FD_CLOEXEC)) {
  /* Handle Error */
}

/* ... */

editor = getenv("EDITOR");
if (editor == NULL) {
  /* Handle getenv() error */
}
system(editor);

...

Code Block
bgColor#ccccff
int fd;
int flags;
char *editor;

if(!(fd = fopenopen(file_name, O_CLOEXEC, O_RDONLY))) {
  /* Handle Error */
}

/* ... */

editor = getenv("EDITOR");
if (editor == NULL) {
  /* Handle getenv() error */
}
system(editor);

...