~profzoom/ubuntu/quantal/wmaker/bug-1079925

« back to all changes in this revision

Viewing changes to src/misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Marcelo E. Magallon
  • Date: 2004-11-10 14:05:30 UTC
  • Revision ID: james.westby@ubuntu.com-20041110140530-gqmm78doyvsmq919
Tags: 0.91.0-2
* debian/wmaker.menu-method: output UTF-8 (thanks Bill) (closes: bug#280011,
  bug#280199)
* debian/rules: include zh_TW again (thanks Geoffrey) (closes: bug#280098)
* debian/wmaker: don't recurse into subdirectories (closes: bug#279577)
* debian/README.Debian: removed outdated information
* src/misc.c: Patch stolen from CVS.
* debian/rules: Add support for noopt DEB_BUILD_OPTIONS
* debian/README.build: remove old info, update current
* debian/patches/20_endian+64bit.diff: patch from Julien Blache to fix
  endianess and 64-bit problems (closes: bug#281185, bug#279884)

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
    line = wmalloc(MAXLINE);
116
116
    *line = 0;
117
117
    i=1;
 
118
    strcat(line, " -traditional -undef");
118
119
    if ((buf=getenv("HOSTNAME"))!=NULL) {
119
120
        if (buf[0]=='(') {
120
121
            wwarning(_("your machine is misconfigured. HOSTNAME is set to %s"),
1215
1216
}
1216
1217
 
1217
1218
 
 
1219
#define MAX_CMD_SIZE 4096
 
1220
 
1218
1221
Bool
1219
1222
GetCommandForPid(int pid, char ***argv, int *argc)
1220
1223
{
1221
 
    char buf[1024];
 
1224
    static char buf[MAX_CMD_SIZE];
1222
1225
    FILE *fPtr;
1223
1226
    int count, i, j;
1224
1227
    Bool ok= False;
1226
1229
    sprintf(buf, "/proc/%d/cmdline", pid);
1227
1230
    fPtr = fopen(buf, "r");
1228
1231
    if (fPtr) {
1229
 
        count = read(fileno(fPtr), buf, 1024);
 
1232
        count = read(fileno(fPtr), buf, MAX_CMD_SIZE);
1230
1233
        if (count > 0) {
1231
 
            buf[count] = 0;
 
1234
            buf[count-1] = 0;
1232
1235
            for (i=0, *argc=0; i<count; i++) {
1233
1236
                if (buf[i] == 0) {
1234
1237
                    (*argc)++;
1246
1249
                    if (i < count-1) {
1247
1250
                        (*argv)[j++] = &buf[i+1];
1248
1251
                    }
 
1252
                    if (j == *argc) {
 
1253
                        break;
 
1254
                    }
1249
1255
                }
1250
1256
                ok= True;
1251
1257
            }