Check-in [85b83206f4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changes to the file_getcwd() routine to avoid a false-positive compiler warning from gcc 10.2.1.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 85b83206f42cb64b5699a721c67e12821d4502782ac57fa8f1bfd09cd78ce551
User & Date: drh 2022-06-23 12:44:23.659
Context
2022-06-23
13:08
In the 'all' command, use strcmp instead of strncmp to compare the subcommand name to avoid the problem described in [forum:8ec0c228c1ce8da5|forum post 8ec0c228c1ce8da5], where (e.g.) the subcommand 's' evaluates to 'server' and 'p' to 'push' despite both of those being ambiguous subcommand name prefixes. check-in: e098d810dc user: stephan tags: trunk
12:44
Changes to the file_getcwd() routine to avoid a false-positive compiler warning from gcc 10.2.1. check-in: 85b83206f4 user: drh tags: trunk
12:10
Update the built-in SQLite to the latest 3.39.0 beta, for SQLite testing. check-in: d7a2bda912 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
** characters are converted to '/'.  No conversions are needed on
** unix.
**
** Store the value of the CWD in zBuf which is nBuf bytes in size.
** or if zBuf==0, allocate space to hold the result using fossil_malloc().
*/
char *file_getcwd(char *zBuf, int nBuf){
  char zTemp[2000];
  if( zBuf==0 ){
    zBuf = zTemp;
    nBuf = sizeof(zTemp);
  }
#ifdef _WIN32
  win32_getcwd(zBuf, nBuf);
#else
  if( getcwd(zBuf, nBuf-1)==0 ){
    if( errno==ERANGE ){
      fossil_fatal("pwd too big: max %d", nBuf-1);
    }else{
      fossil_fatal("cannot find current working directory; %s",
                   strerror(errno));
    }
  }
#endif
  return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf;
}

/*
** Return true if zPath is an absolute pathname.  Return false
** if it is relative.
*/
int file_is_absolute_path(const char *zPath){







<

|
|













|







1190
1191
1192
1193
1194
1195
1196

1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
** characters are converted to '/'.  No conversions are needed on
** unix.
**
** Store the value of the CWD in zBuf which is nBuf bytes in size.
** or if zBuf==0, allocate space to hold the result using fossil_malloc().
*/
char *file_getcwd(char *zBuf, int nBuf){

  if( zBuf==0 ){
    char zTemp[2000];
    return fossil_strdup(file_getcwd(zTemp, sizeof(zTemp)));
  }
#ifdef _WIN32
  win32_getcwd(zBuf, nBuf);
#else
  if( getcwd(zBuf, nBuf-1)==0 ){
    if( errno==ERANGE ){
      fossil_fatal("pwd too big: max %d", nBuf-1);
    }else{
      fossil_fatal("cannot find current working directory; %s",
                   strerror(errno));
    }
  }
#endif
  return zBuf;
}

/*
** Return true if zPath is an absolute pathname.  Return false
** if it is relative.
*/
int file_is_absolute_path(const char *zPath){