~ubuntu-branches/ubuntu/intrepid/curl/intrepid-security

« back to all changes in this revision

Viewing changes to lib/file.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-06-18 15:21:57 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080618152157-qq94aiequcq35w6b
Tags: 7.18.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Drop the stunnel build dependency.
  - Drop the build-dependency on libdb4.5-dev
  - Add build-dependency on openssh-server
  - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: file.c,v 1.105 2008-01-11 16:49:35 yangtse Exp $
 
21
 * $Id: file.c,v 1.109 2008-05-21 21:36:42 danf Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
68
68
#include <fcntl.h>
69
69
#endif
70
70
 
71
 
#endif
 
71
#endif /* WIN32 */
72
72
 
73
73
#include "strtoofft.h"
74
74
#include "urldata.h"
90
90
/* The last #include file should be: */
91
91
#include "memdebug.h"
92
92
 
 
93
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || defined(__SYMBIAN32__)
 
94
#define DOS_FILESYSTEM 1
 
95
#endif
93
96
 
94
97
/*
95
98
 * Forward declarations.
186
189
  char *real_path = curl_easy_unescape(data, data->state.path, 0, NULL);
187
190
  struct FILEPROTO *file;
188
191
  int fd;
189
 
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
 
192
#ifdef DOS_FILESYSTEM
190
193
  int i;
191
194
  char *actual_path;
192
195
#endif
217
220
    file->fd = -1;
218
221
  }
219
222
 
220
 
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
 
223
#ifdef DOS_FILESYSTEM
221
224
  /* If the first character is a slash, and there's
222
225
     something that looks like a drive at the beginning of
223
226
     the path, skip the slash.  If we remove the initial
279
282
  return CURLE_OK;
280
283
}
281
284
 
282
 
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
 
285
#ifdef DOS_FILESYSTEM
283
286
#define DIRSEP '\\'
284
287
#else
285
288
#define DIRSEP '/'
319
322
  else {
320
323
    int fd;
321
324
 
322
 
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__)
 
325
#ifdef DOS_FILESYSTEM
323
326
    fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
324
327
              conn->data->set.new_file_perms);
325
 
#else /* !(WIN32 || MSDOS || __EMX__) */
 
328
#else
326
329
    fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,
327
330
              conn->data->set.new_file_perms);
328
 
#endif /* !(WIN32 || MSDOS || __EMX__) */
 
331
#endif
329
332
    if(fd < 0) {
330
333
      failf(data, "Can't open %s for writing", file->path);
331
334
      return CURLE_WRITE_ERROR;
454
457
  /* If we have selected NOBODY and HEADER, it means that we only want file
455
458
     information. Which for FILE can't be much more than the file size and
456
459
     date. */
457
 
  if(conn->bits.no_body && data->set.include_header && fstated) {
 
460
  if(data->set.opt_no_body && data->set.include_header && fstated) {
458
461
    CURLcode result;
459
462
    snprintf(buf, sizeof(data->state.buffer),
460
463
             "Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);