From 455d963962d8f655009fb966c54b74b197da971b Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 5 Dec 2011 09:26:33 -0800 Subject: [PATCH] Don't ignore return value from getcwd() --- Makefile | 3 ++- ispc.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4a948983..10deb342 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,8 @@ BUILD_VERSION=$(shell git log --abbrev-commit --abbrev=16 | head -1) CXX=g++ CPP=cpp -CXXFLAGS=-g3 $(LLVM_CXXFLAGS) -I. -Iobjs/ -Wall $(LLVM_VERSION_DEF) \ +OPT=-g3 +CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -Wall $(LLVM_VERSION_DEF) \ -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" LDFLAGS= diff --git a/ispc.cpp b/ispc.cpp index 46e32d77..327d994d 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -353,7 +353,8 @@ Globals::Globals() { #ifdef ISPC_IS_WINDOWS _getcwd(currentDirectory, sizeof(currentDirectory)); #else - getcwd(currentDirectory, sizeof(currentDirectory)); + if (getcwd(currentDirectory, sizeof(currentDirectory)) == NULL) + FATAL("Current directory path too long!"); #endif }