File: fd_move.c

package info (click to toggle)
runit 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,220 kB
  • sloc: ansic: 5,572; sh: 3,588; makefile: 383
file content (15 lines) | stat: -rw-r--r-- 215 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* Public domain. */

#include <unistd.h>
#include "fd.h"

int fd_move(int to,int from)
{
  if (to == from) return 0;
  if (fd_copy(to,from) == -1) {
    close(from);
    return -1;
  }
  close(from);
  return 0;
}