~ubuntu-branches/ubuntu/vivid/aspectc++/vivid

« back to all changes in this revision

Viewing changes to Puma/src/basics/SysCall.cc

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-05-30 10:01:33 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20120530100133-rnwnvxsb3xfsvu2w
Tags: 1:1.1+svn20120529-1
* New upstream snapshot.
  - Fixes with fcntl handling on kFreeBSD
  - Upstream fixes in the Puma Parser

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
  int fd = open (file, flags, err);
159
159
#if defined(__GLIBC__)
160
160
  if (!(fd < 0)) {
161
 
    flock lock = { F_WRLCK, SEEK_SET, 0, 0, 0 };
 
161
    flock lock;
 
162
    memset (&lock, 0, sizeof lock);
 
163
    lock.l_type = F_WRLCK;
 
164
    lock.l_whence = SEEK_SET;
162
165
    if (fcntl (fd, F_SETLKW, &lock) == -1)
163
166
      printerror (err, "fcntl lock", file);
164
167
  }
186
189
  int fd = create (file, mode, err);
187
190
#if defined(__GLIBC__)
188
191
  if (!(fd < 0)) {
189
 
    flock lock = { F_WRLCK, SEEK_SET, 0, 0, 0 };
 
192
    flock lock;
 
193
    memset (&lock, 0, sizeof lock);
 
194
    lock.l_type = F_WRLCK;
 
195
    lock.l_whence = SEEK_SET;
190
196
    if (fcntl (fd, F_SETLKW, &lock) == -1)
191
197
      printerror (err, "fcntl lock", file);
192
198
  }
205
211
 
206
212
bool SysCall::close_excl (int fd, ErrorSink *err) {
207
213
#if defined(__GLIBC__)
208
 
  flock lock = { F_UNLCK, SEEK_SET, 0, 0, 0 };
 
214
  flock lock;
 
215
  memset (&lock, 0, sizeof lock);
 
216
  lock.l_type = F_UNLCK;
 
217
  lock.l_whence = SEEK_SET;
209
218
  if (fcntl (fd, F_SETLKW, &lock) == -1) {
210
219
    printerror (err, "fcntl unlock", fd);
211
220
    return false;