View | Details | Raw Unified | Return to bug 12135
Collapse All | Expand All

(-)scrollkeeper-0.3.14.orig/libs/database.c (-7 / +7 lines)
Lines 17-22 Link Here
17
 */
17
 */
18
 
18
 
19
#include <config.h>
19
#include <config.h>
20
#include <limits.h>
20
#include <stdlib.h>
21
#include <stdlib.h>
21
#include <string.h>
22
#include <string.h>
22
#include <stddef.h>
23
#include <stddef.h>
Lines 27-35 Link Here
27
#include <dirent.h>
28
#include <dirent.h>
28
#include <scrollkeeper.h>
29
#include <scrollkeeper.h>
29
30
30
#define PATHLEN		256
31
32
33
/*
31
/*
34
 * Create a directory.  Send errors to appropriate places (STDOUT and log 
32
 * Create a directory.  Send errors to appropriate places (STDOUT and log 
35
 * file) according to command-line flags.
33
 * file) according to command-line flags.
Lines 55-61 static int sk_mkdir(char *path, mode_t o Link Here
55
 */
53
 */
56
int sk_mkdir_with_parents(char *fullpath, mode_t options, char outputprefs)
54
int sk_mkdir_with_parents(char *fullpath, mode_t options, char outputprefs)
57
{
55
{
58
    char path[1024];
56
    char path[PATH_MAX];
59
    char slash[]="/";
57
    char slash[]="/";
60
    char delim[]="/";
58
    char delim[]="/";
61
    char *token, *pathcopy;
59
    char *token, *pathcopy;
Lines 63-77 int sk_mkdir_with_parents(char *fullpath Link Here
63
61
64
    pathcopy = strdup(fullpath); /* Copy b/c strtok edits the string it operates on */
62
    pathcopy = strdup(fullpath); /* Copy b/c strtok edits the string it operates on */
65
    path[0] = '\0';              /* Initialize with end of string null character */
63
    path[0] = '\0';              /* Initialize with end of string null character */
66
    if (pathcopy[0] == slash[0]) sprintf(path, "/"); /* preserve any starting slash */
64
    if (pathcopy[0] == slash[0]) strcpy(path, "/"); /* preserve any starting slash */
67
     
65
     
68
    token = strtok (pathcopy, delim);
66
    token = strtok (pathcopy, delim);
69
    delim[0]=slash[0];
67
    delim[0]=slash[0];
70
    while(token != NULL) {
68
    while(token != NULL) {
69
        const int path_len = strlen(path);
71
        if (strlen(path) == 0 || ((strlen(path) == 1) && (path[0] == slash[0]))) {
70
        if (strlen(path) == 0 || ((strlen(path) == 1) && (path[0] == slash[0]))) {
72
                sprintf(path, "%s%s", path, token);
71
                strncat(path, token, sizeof(path) - path_len - 1);
73
        } else {
72
        } else {
74
                sprintf(path, "%s/%s", path, token);
73
                strncat(path, "/", sizeof(path) - path_len - 1);
74
                strncat(path, token, sizeof(path) - path_len - 2);
75
        }
75
        }
76
        if (stat(path, &buf) == -1) {
76
        if (stat(path, &buf) == -1) {
77
            if (sk_mkdir(path, options, outputprefs) != 0) {
77
            if (sk_mkdir(path, options, outputprefs) != 0) {
(-)scrollkeeper-0.3.14.orig/libs/install.c (-1 lines)
Lines 32-38 Link Here
32
#define _(String) gettext (String)
32
#define _(String) gettext (String)
33
33
34
#define SEP		"|"
34
#define SEP		"|"
35
#define PATHLEN		256
36
35
37
#ifdef SOLARIS
36
#ifdef SOLARIS
38
/*extern char *strtok_r(char *, const char *, char **);*/
37
/*extern char *strtok_r(char *, const char *, char **);*/
(-)scrollkeeper-0.3.14.orig/libs/scrollkeeper.h.in (-1 / +2 lines)
Lines 32-38 Link Here
32
#define SCROLLKEEPERLOGFILE "@localstatedir@/log/scrollkeeper.log"
32
#define SCROLLKEEPERLOGFILE "@localstatedir@/log/scrollkeeper.log"
33
#define SCROLLKEEPERLOGFILE_ROT "@localstatedir@/log/scrollkeeper.log.1"
33
#define SCROLLKEEPERLOGFILE_ROT "@localstatedir@/log/scrollkeeper.log.1"
34
#define SCROLLKEEPER_OMF_DTD "@prefix@/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd"
34
#define SCROLLKEEPER_OMF_DTD "@prefix@/share/xml/scrollkeeper/dtds/scrollkeeper-omf.dtd"
35
#define PATHLEN		256
35
#include <limits.h>
36
#define PATHLEN		PATH_MAX
36
37
37
/*
38
/*
38
 *
39
 *
(-)scrollkeeper-0.3.14.orig/libs/uninstall.c (-2 lines)
Lines 29-36 Link Here
29
29
30
#define _(String) gettext (String)
30
#define _(String) gettext (String)
31
31
32
#define PATHLEN		256
33
34
struct IdTab {
32
struct IdTab {
35
    int id;
33
    int id;
36
    char *locale;
34
    char *locale;

Return to bug 12135