/ Check-in [ea011990]
Login

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

Overview
Comment:Fix for ticket #137: Use getpwuid() instead of getpwent(). (CVS 723)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ea011990c552a7a6019b63f9b4341ad6c8663479
User & Date: drh 2002-08-21 11:26:41
Context
2002-08-22
18:18
Fix for ticket #138: Makefile doesn't use exec_prefix, has some install problems (CVS 724) check-in: 97fc4a71 user: jadams tags: trunk
2002-08-21
11:26
Fix for ticket #137: Use getpwuid() instead of getpwent(). (CVS 723) check-in: ea011990 user: drh tags: trunk
2002-08-18
22:41
This COLLATE keyword was not being parsed correctly inside CREATE TABLE statements - it was being included as part of the datatype. This fixes the problem. (CVS 722) check-in: 39bd52d3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.61 2002/07/13 17:33:45 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
*/
static char *find_home_dir(void){
  char *home_dir = NULL;

#if !defined(_WIN32) && !defined(WIN32)
  struct passwd *pwent;
  uid_t uid = getuid();
  while( (pwent=getpwent()) != NULL) {
    if(pwent->pw_uid == uid) {
      home_dir = pwent->pw_dir;
      break;
    }
  }
#endif

  if (!home_dir) {
    home_dir = getenv("HOME");
    if (!home_dir) {
      home_dir = getenv("HOMEPATH"); /* Windows? */







|







 







|
<
|
<
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
980
981
982
983
984
985
986
987

988


989
990
991
992
993
994
995
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.62 2002/08/21 11:26:41 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
*/
static char *find_home_dir(void){
  char *home_dir = NULL;

#if !defined(_WIN32) && !defined(WIN32)
  struct passwd *pwent;
  uid_t uid = getuid();
  if( (pwent=getpwuid(uid)) != NULL) {

    home_dir = pwent->pw_dir;


  }
#endif

  if (!home_dir) {
    home_dir = getenv("HOME");
    if (!home_dir) {
      home_dir = getenv("HOMEPATH"); /* Windows? */