blob: 47322b0f9ed3c1c705065e36ea4fa3368b63b7f3 [file] [log] [blame]
Reid Spencer55cf0a62004-12-22 10:24:55 +00001//===- Support/FileUtilities.cpp - File System Utilities ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements a family of utility functions which are useful for doing
11// various things with files.
12//
13//===----------------------------------------------------------------------===//
14
15#include "FDHandle.h"
16#include <unistd.h>
17
18using namespace llvm;
19
20//===----------------------------------------------------------------------===//
21// FDHandle class implementation
22//
23
24FDHandle::~FDHandle() throw() {
25 if (FD != -1)
26 ::close(FD);
27}
28
29FDHandle &FDHandle::operator=(int fd) throw() {
30 if (FD != -1)
31 ::close(FD);
32 FD = fd;
33 return *this;
34}