diff --git a/uppsrc/Core/BlockStream.cpp b/uppsrc/Core/BlockStream.cpp index e8145ac3d..b1a260cc6 100644 --- a/uppsrc/Core/BlockStream.cpp +++ b/uppsrc/Core/BlockStream.cpp @@ -470,12 +470,15 @@ bool FileStream::Open(const char *name, dword mode, mode_t tmode) { O_RDWR|O_CREAT, tmode); if(handle >= 0) { - if((mode & NOWRITESHARE) && flock(handle, LOCK_EX|LOCK_NB) < 0) { + struct stat st[1]; + fstat(handle, st); + if(!(st->st_mode & S_IFREG) || // not a regular file, e.g. folder - bad things would happen + (mode & NOWRITESHARE) && flock(handle, LOCK_EX|LOCK_NB) < 0) { // lock if not sharing close(handle); handle = -1; return false; } - int64 fsz = LSEEK64_(handle, 0, SEEK_END); + int64 fsz = st->st_size; if(fsz >= 0) { OpenInit(mode, fsz); LLOG("OPEN handle " << handle); diff --git a/uppsrc/Core/Value.cpp b/uppsrc/Core/Value.cpp index c355361c8..b75c3b134 100644 --- a/uppsrc/Core/Value.cpp +++ b/uppsrc/Core/Value.cpp @@ -608,7 +608,6 @@ const Value& Value::operator[](int i) const const Vector& Value::GetVA() const { if(IsRef()) { - dword t = GetRefType(); if(Is()) return ((ValueArray::Data *)ptr())->data; if(Is()) diff --git a/uppsrc/RichText/EncodeHTML.cpp b/uppsrc/RichText/EncodeHTML.cpp index b181fc333..a3de81129 100644 --- a/uppsrc/RichText/EncodeHTML.cpp +++ b/uppsrc/RichText/EncodeHTML.cpp @@ -350,7 +350,7 @@ String DefaultHtmlObjectSaver::GetHtml(const RichObject& object, const String& l png.SaveFile(AppendFileName(outdir, name), object.ToImage(sz)); String el = ""; if(IsNull(link)) { - if(psz.cx * psz.cy) + if(psz.cx * psz.cy != 0) html << ""; else el.Clear(); @@ -359,7 +359,7 @@ String DefaultHtmlObjectSaver::GetHtml(const RichObject& object, const String& l html << ""; html << "\"\""; html << el; - if(IsNull(link) && psz.cx * psz.cy) { + if(IsNull(link) && psz.cx * psz.cy != 0) { PNGEncoder png; png.SaveFile(AppendFileName(outdir, lname), object.ToImage(psz)); }